<%
head =検索
searchString = request(searchstring)
count = 0
'現在のディレクトリの実際のパスを仮想パスに変換します
機能unmappath(パス)
unmappath = falple(mid(path、len(server.mappath( /)) + 1)、 /、 /)
エンド関数
function searchfile(f、s、title)
fo = fs.opentextfile(f)を設定します
content = fo.readall 'すべてのテキストをコンテンツに読み取ります
fo.close
searchfile = strunt(1、content、s、vbtextcompare)> 0 '最初の文字から、コンテンツにsがあるかどうかを確認する
searchFileの場合、その場合、ファイルタイトルデポジット変数
pos1 = strust(1、content、<title>、vbtextcompare)
pos2 = strust(1、content、</title>、vbtextcompare)
title =
pos1> 0およびpos2> 0の場合、タイトルタグの途中でキャラクターを作成しません
title = mid(content、pos1 + 7、pos2 -pos1-7)
ifを終了します
ifを終了します
エンド関数
関数filelink(f、title)
vpath = unmappath(f.path) 'パスを取ります
if title = then then title = f.name 'を作成するリンクを作成する
filelink = <a href =&vpath&>&title&</a>
filelink = <ul>・&filelink&</ul>
エンド関数
Sub SearchFolder(FD、S)
見つかった= false
fd.filesの各fに対して
pos = instrrev(f.path、。)
pos> 0の場合
ext = mid(f.path、pos + 1)
それ以外
ext =
ifを終了します
lcase(ext)= htm then'show extension名htmの場合
SearchFile(f、s、title)の場合
Response.writefilelink(f、title)
count = count+1
'Response.Write CSTR(count)
ifを終了します
ifを終了します
次
FD.Subfoldersの各SFDについて
SearchFolder SFD、s
次
End Sub
%>
<html>
<head>
<メタhttp-equiv = content-type
content = text/html; charset = gb_2312-80>
<メタ名=ジェネレーターコンテンツ= Microsoft FrontPage Express 2.0>
<title> <%= head%> </title>
</head>
<body bgcolor =#ffffff>
<h1> <%= head%> </h1>
<hr>
<form action = search.asp method = get>
<p>検索するコンテンツを入力してください:<入力タイプ=テキスト
サイズ= 20 name = searchstring値= <%= searchstring%>> <入力
type =送信値=検索> </p>
</form>
<%
fs = server.createObject(scripting.filesystemObject)を設定します
fd = fs.getfolder(server.mappath(/)) 'パスを設定して検索を開始します!
SearchString <> thenの場合
Response.Write <H2>検索<Font Color = Red>&SearchString&</font>結果は次のとおりです。</h2> <p>
SearchFolder FD、SearchString
ifを終了します
%>
<hr>