<%
머리 = 검색
searchString = request (searchString)
카운트 = 0
'현재 디렉토리의 실제 경로를 가상 경로로 변환
기능 unmappath (경로)
UnmAppath = replace (mid, len (server.mappath ( /)) + 1), /, /)
엔드 기능
함수 SearchFile (F, S, 제목)
fo = fs.opentextfile (f) 설정
content = fo.readall '모든 텍스트를 컨텐츠로 읽으십시오
fo.close
searchFile = instr (1, content, s, vbtextcompare)> 0 '컨텐츠에 S가 있는지 확인하기 위해 첫 번째 문자에서 0'
SearchFile이 있으면 파일 제목 입금 변수가있는 경우
pos1 = instr (1, 컨텐츠, <title>, vbtextcompare)
pos2 = instr (1, 컨텐츠, </title>, vbtextcompare)
제목 =
POS1> 0 및 POS2> 0이면 제목 태그 중간에 문자를 얻지 못합니다.
Title = MID (Content, POS1 + 7, POS2 -POS1-7)
끝 If
끝 If
엔드 기능
기능 filelink (f, 제목)
vpath = unmappath (f.path) '길을 따라 가십시오
If Title = the Title = F.Name '링크를 만들려면'
filelink = <a href = & vpath &> & title & </a>
filelink = <ul> · & filelink & </ul>
엔드 기능
하위 검색 폴더 (fd, s)
발견 = 거짓
fd.files의 각 F에 대해
pos = instrev (f.path,.)
POS> 0이라면
ext = mid (f.path, pos + 1)
또 다른
ext =
끝 If
lcase (ext) = htm 인 경우 extension name htm 인 파일
SearchFile (f, s, title) 인 경우
Response.Write FilElink (F, Title)
count = count+1
'응답. cstr (count).
끝 If
끝 If
다음
fd.subfolders의 각 SFD에 대해
searchfolder sfd, s
다음
종료 서브
%>
<html>
<헤드>
<meta http-equiv = 컨텐츠-타입
내용 = 텍스트/html; charset = gb_2312-80>
<meta name = Generator Content = Microsoft FrontPage Express 2.0>
<title> <%= Head%> </title>
</head>
<바디 bgcolor =#ffffff>
<h1> <%= 머리%> </h1>
<HR>
<form action = search.asp method = get>
<p> 검색하려는 내용을 입력하십시오 : <입력 유형 = 텍스트
size = 20 name = searchString 값 = <%= searchString%>> <입력
유형 = 제출 값 = 검색> </p>
</form>
<%
set fs = server.createobject (scripting.filesystemobject)
fd = fs.getfolder (server.mappath (/)) '검색을 시작할 경로를 설정하십시오!
SearchString <>라면
response.write <h2> 검색 <font color = red> & searchString & </font> 결과는 다음과 같습니다. </h2> <p>
SearchFolder FD, SearchString
끝 If
%>
<HR>