<%
Sub ShowList()
FolderToCheck = server.mappath("\") &"/" & FolderName & "/"
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(FolderToCheck)
Set fc = f.Files
For Each f1 in fc
Wfile = f1.name
if right(Wfile, 5)=".html" OR right(Wfile, 4)=".htm" then
Wfile2 = FolderToCheck & Wfile
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile(Wfile2)
ct = a.ReadAll
a.close
ct2=lcase(ct)
SearchTerm2 = lcase(SearchTerm)
if instr(ct2,SearchTerm2)>0
then
if instr(ct,"</title>")>0
then
longitud=instr(ct,"</title>")
longitud=longitud -1
ct=left(ct,longitud)
longitud2=len(ct)
longitud=instr(ct,"<title>")
longitud=longitud2 -longitud -6
ct=right(ct,longitud)
else
if instr(ct,"</TITLE>")>0 then
longitud=instr(ct,"</TITLE>")
longitud=longitud -1
ct=left(ct,longitud)
longitud2=len(ct)
longitud=instr(ct,"<TITLE>")
longitud=longitud2 -longitud -6
ct=right(ct,longitud)
end if
end if
SearchResponse= SearchResponse
+"<TR><TD>"+ ct + "</TD><TD
ALIGN=CENTER VALIGN=MIDDLE>" + " <A
HREF=" + "/" + FolderName + "/" +
Wfile +"> More </A></TD></TR>"
longitud=0
ct=""
end if
end if
Next
Response.Write ("<HTML><HEAD>
<TITLE>Search results</TITLE>
</HEAD>
<BODY BGCOLOR=FFFFFF><CENTER>")
Response.Write ("<TABLE
BORDER=0 WIDTH=550><TR><TD BGCOLOR=C0C0C0><FONT
SIZE=5><B>Search Results</B></FONT></TD></TR></TABLE>")
Response.Write ("<TABLE
BORDER=0 WIDTH=550>")
if SearchResponse<>"" then
Response.Write SearchResponse
else
Response.Write ("<TR><TD>The specified term or phrase
was not found</TD></TR>")
end if
Response.Write ("</TABLE>")
Response.Write ("<TABLE
BORDER=0 WIDTH=550><TR>
<TD BGCOLOR=C0C0C0 ALIGN=RIGHT><FONT SIZE=1>Search utility provided
by <A HREF=http://www.asptutorial.info>AspTutorial.info</A>
</FONT></TD></TR></TABLE>")
Response.Write ("</CENTER></BODY></HTML>")
End Sub
%>
|