searchpage.htm
‘ æÂÂ索页é¢.
<html>xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /??
<head>
àààà<title>Ã¥ÂÂè±é£ÂèÂÂä¹Âç«ÂÃ¥ÂÂ
æÂÂç´¢å¼ÂæÂÂ</title>
ÃÂ ÃÂ </head>
ÃÂ ÃÂ <body>
ÃÂ ÃÂ ÃÂ ÃÂ <CENTER>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ <FORM METHOD=POST ACTION=”searchresult.asp”>
ÃÂ ÃÂ <TABLE BGCOLOR=”#BLUE” BORDER=”0″>
ÃÂ ÃÂ ÃÂ <tr>ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ
ÃÂ ÃÂ ÃÂ ÃÂ <td ROWSPAN=”3″ BGCOLOR=”#BLUE” width=”21″ nowrap></td>
ÃÂ ÃÂ ÃÂ ÃÂ <td width=”363″ nowrap> <FONT COLOR=”#FFFFFF”>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ <INPUT TYPE=”text” NAME=”SearchText” SIZE=”22″>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ <INPUT TYPE=”checkbox” NAME=”Case”>
àààààé«Â度æÂÂæÂÂ</FONT> </td>
ÃÂ ÃÂ ÃÂ ÃÂ <td ROWSPAN=”3″ width=”10″>
ààààà<INPUT TYPE=”submit” VALUE=”æÂÂç´¢“>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ <P>
ààààà<INPUT TYPE=”reset” VALUE=”éÂÂå“>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ </td>
ÃÂ ÃÂ ÃÂ ÃÂ <td ROWSPAN=”3″ BGCOLOR=”#BLUE” width=”28″></td>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ </tr>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ <tr>
àààà<td width=”363″ nowrap> <FONT COLOR=”#FFFFFF”> æÂÂç´¢è¿ÂÃ¥ÂÂç»ÂæÂÂ
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ <select name=”rLength” >
àààààà<option value=”200″ selected>详ç»Âä¿¡æ¯</option>
àààààà<option value=”100″>ç®ÂçÂÂä¿¡æ¯</option>
àààààà<option value=”0″>åªè¿ÂÃ¥ÂÂè¿ÂæÂÂ¥</option>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ </select>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ <select NAME=”rResults”>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ <OPTION VALUE=”10″ selectED>10
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ <OPTION VALUE=”25″>25
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ <OPTION VALUE=”50″>50
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ </select>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ </FONT>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ </td>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ </tr>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ <tr>
àààà<td width=”363″ nowrap> <FONT COLOR=”#FFFFFF”> å¿Â
é¡»åÂÂ
å«:
ààààààà<INPUT TYPE=”checkbox” NAME=”iImage”>å¾çÂÂ
ààààààà<INPUT TYPE=”checkbox” NAME=”iZips”>Zipæ ¼å¼Â
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ <INPUT TYPE=”checkbox” NAME=”iJavaS”> javascript
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ </FONT>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ </td>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ </tr>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ </TABLE>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ </FORM>
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ </CENTER>
<DL>
</DL>
</body></html>
searchresult.asp
‘ æÂÂç´¢ç»ÂæÂÂ.
<html>
<head>
<title>Ã¥ÂÂè±é£ÂèÂÂç«ÂÃ¥ÂÂ
‘<%=Request(“SearchText”)%>’ä¹ÂæÂÂç´¢ç»ÂæÂÂ</title>
</head>
<body>
<B>'<%=Request(“SearchText”)%>’çÂÂæÂÂç´¢ç»ÂæÂÂ</B><BR>
<%
Const fsoForReading = 1
Dim objFile, objFolder, objSubFolder, objTextStream
Dim bolCase, bolFileFound, bolTagFound
Dim strCount, strDeTag, strExt, strFile, strContent, strRoot, strTag, strText, strtitle, strtitleL
Dim reqImage, reqJavaS, reqLength, reqNumber, reqZip
strFile = “.asp .htm .html .js .txt .css”
strRoot = “/”
strText = Request(“SearchText”)
strTag = Chr(37) & Chr(62)
bolFileFound = False
bolTagFound = False
If Request(“Case”) = “on” Then bolCase = 0 Else bolCase = 1
If Request(“iImage”) = “on” Then reqImage = “<IMG” Else reqImage = “”
If Request(“iZips”) = “on” Then reqZips = “.zip” Else reqImage = “”
If Request(“iJavaS”) = “on” Then reqJavaS = “javascript” Else reqImage = “”
If Request(“rResults”) = “10” Then reqNumber = 10
If Request(“rResults”) = “25” Then reqNumber = 25
If Request(“rResults”) = “50” Then reqNumber = 50
reqLength = Request(“rLength”)
Set objFSO = Server.CreateObject(“Scripting.FileSystemObject”)
Set objFolder = objFSO.GetFolder(Server.MapPath(strRoot))
schSubFol(objFolder)
Sub schSubFol(objFolder)
ÃÂ ÃÂ For Each objFile in objFolder.Files
ÃÂ ÃÂ ÃÂ ÃÂ If strCount + 1 > reqNumber or strText = “” Then Exit Sub
ÃÂ ÃÂ ÃÂ ÃÂ If Response.IsClientConnected Then
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ Set objTextStream = objFSO.OpenTextFile(objFile.Path,fsoForReading)
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ strContent = objTextStream.ReadAll
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ If InStr(1, strContent, strTag, bolCase) Then
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ Else
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ If Mid(objFile.Name, Len(objFile.Name) – 1, 1) = “.” Then strExt = Mid(objFile.Name, Len
(objFile.Name) – 1, 2)
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ If Mid(objFile.Name, Len(objFile.Name) – 2, 1) = “.” Then strExt = Mid(objFile.Name, Len
(objFile.Name) – 2, 3)
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ If Mid(objFile.Name, Len(objFile.Name) – 3, 1) = “.” Then strExt = Mid(objFile.Name, Len
(objFile.Name) – 3, 4)
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ If Mid(objFile.Name, Len(objFile.Name) – 4, 1) = “.” Then strExt = Mid(objFile.Name, Len
(objFile.Name) – 4, 5)
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ If InStr(1, strContent, strText, bolCase) And _
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ InStr(1, strContent, reqImage, 1) And _
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ InStr(1, strContent, reqZips, 1) And _
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ InStr(1, strContent, reqJavaS, 1) And _
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ Instr(1, strFile, strExt, 1) Then
ààààààààààIf InStr(1, strContent, “<title>”, 1) Then strtitle = Mid(strContent, InStr(1, strContent, “<title>”, 1) + 7, InStr(1, strContent, “</title>”, 1)) Else strtitle = “æªå½å“
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ strCount = strCount + 1
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ Response.Write “<DL><DT><B><I>”& strCount &”</I></B> – <A HREF=” & objFile.Path & “>”
& strtitle & “</A></A></DT><BR><DD>”
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ strtitleL = InStr(1, strContent, “</title>”, 1) – InStr(1, strContent, “<title>”, 1) +7
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ strDeTag = “”
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ bolTagFound = False
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ Do While InStr(strContent, “<“)
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ bolTagFound = True
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ strDeTag = strDeTag & ” ” & Left(strContent, InStr(strContent, “<“) – 1)
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ strContent = MID(strContent, InStr(strContent, “>”) + 1)
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ Loop
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ strDeTag = strDeTag & strContent
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ If Not bolTagFound Then strDeTag = strContent
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ If reqLength = “0” Then Response.Write objFile.Path & “</DD></DL>” Else Response.Write
Mid(strDeTag, strtitleL, reqLength) & “…<BR><b><FONT SIZE=’2′>URL: ” & objFile.Path & ” – ä¸Â次修æ¹æ¶
é´: ” & objFile.DateLastModified & ” – ” & FormatNumber(objFile.Size / 1024)
& “Kbytes</FONT></b></DD></DL>”
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ bolFileFound = True
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ End If
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ objTextStream.Close
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ End If
ÃÂ ÃÂ ÃÂ ÃÂ End If
ÃÂ ÃÂ Next
End Sub
For Each objSubFolder in objFolder.SubFolders
ÃÂ ÃÂ schSubFol(objSubFolder)
Next
If Not bolFileFound then Response.Write “æ±æÂÂ,没æÂÂæ¾å°æ¨è¦ÂæÂÂç´¢çÂÂç»ÂæÂÂ!”
If bolFileFound then Response.Write “<B>æÂÂç´¢ç»ÂæÂÂ</B>”
Set objTextStream = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
%>
</body></html>
ÃÂ
ÃÂ
[1]