<%
Cabeza = búsqueda
SearchString = request (SearchString)
recuento = 0
'Convierta la ruta real del directorio actual en una ruta virtual
Función Unmappath (ruta)
Unmappath = reemplazar (Mid (ruta, len (server.mappath ( /)) + 1), /, /)
Función final
Función SearchFile (F, S, Título)
Establecer fo = fs.opeNextFile (f)
contenido = fo.Readall 'Lea todo el texto al contenido
fo.clar
SearchFile = Instr (1, Content, S, VbTextCompare)> 0 'desde el primer carácter para verificar si hay S en el contenido
Si SearchFile entonces, si hay, el título de Título de la variable de depósito
pos1 = instr (1, contenido, <title>, vbTextCompare)
pos2 = instr (1, contenido, </title>, vbTextCompare)
Título =
Si POS1> 0 y POS2> 0, entonces, entonces esté el personaje en el medio de la etiqueta del título
Title = Mid (Content, Pos1 + 7, Pos2 - Pos1 - 7)
Final si
Final si
Función final
Función filelink (f, título)
vpath = unmappath (f.path) 'Toma el camino
If title = entonces title = f.name 'para hacer enlaces
Filelink = <a href = & vpath &> & title & </a>
Filelink = <ul> · & Filelink & </ul>
Función final
SUB Searchfolder (FD, S)
encontrado = falso
Para cada F en FD.Files
pos = instrrev (f.path,.)
Si pos> 0 entonces
Ext = Mid (F.Path, Pos + 1)
Demás
ext =
Final si
Si lcase (ext) = htm entonces, entonces el archivo con nombre de extensión htm
Si SearchFile (f, s, título) entonces
Response.WRITE FILELINK (F, Título)
recuento = recuento+1
'Response.Write CSTR (Count)
Final si
Final si
Próximo
Para cada SFD en FD.
Searchfolder SFD, S
Próximo
Final
%>
<html>
<Evista>
<meta http-outiv = contenido-type
contenido = texto/html; Charset = GB_2312-80>
<meta name = generador content = Microsoft FrontPage Express 2.0>
<title> <%= head%> </title>
</ablo>
<Body bgcolor =#ffffff>
<h1> <%= head%> </h1>
<hr>
<Form Action = Search.asp Method = get>
<p> Por favor ingrese el contenido que desea buscar: <input type = text
size = 20 name = SearchString Value = <%= SearchString%>> <entrada
type = enviar valor = búsqueda> </p>
</form>
<%
Establecer fs = server.createObject (scripting.filesystemObject)
Establecer fd = fs.getfolder (server.mappath (/)) '¡Establezca la ruta para iniciar la búsqueda!
Si searchString <> entonces
Response.write <h2> search <font color = rojo> & searchstring & </font> Los resultados son los siguientes: </h2> <p>
Searchfolder FD, SearchString
Final si
%>
<hr>