首页 > 互联资讯 > 技术交流  > 

如何做一个只搜索本网站的引擎?

searchfiles.html

</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">撼雪喷云之本网搜索引擎</SPAN><SPAN lang=EN-US>

请输入条目或关键词 type="submit" value="搜索">

searchfiles.asp
<%
SearchTerm = request.form("term")
Novalid=" a b c d e f g h i j k l m n o p q r s t u v w x y z yes no and more"
NovalidResponse ="
你输入的内容过于简单,请返回重试!"

if instr(SearchTerm,Novalid)=0 then
Response. Write ("

搜索结果

")

FolderName= "FolderName"
ShowList()

else
Response.Write NovalidResponse
End if

SearchResponse=""
%>

<%
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,"")>0 then
longitud=instr(ct,"")
longitud=longitud -1
ct=left(ct,longitud)
longitud2=len(ct)
longitud=instr(ct,"") <BR> longitud=longitud2 -longitud -6 <BR> ct=right(ct,longitud) <BR> else <BR> if instr(ct,"")>0 then
longitud=instr(ct,"")
longitud=longitud -1
ct=left(ct,longitud)
longitud2=len(ct)
longitud=instr(ct,"") <BR> longitud=longitud2 -longitud -6 <BR> ct=right(ct,longitud) <BR> end if <BR> end if <br><br> SearchResponse= SearchResponse +"<tr><td>"+ ct + "</td><td ALIGN=CENTER <BR>VALIGN=MIDDLE>" + " <A HREF=" + "/" + FolderName + "/" + Wfile +"> More </A></td></tr>" <BR> longitud=0 <BR> ct="" <br><br> end if <BR> end if <br><br>Next <br><br>Response.Write ("<html><head><title></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">搜索结果</SPAN><SPAN lang=EN-US>
")

Response.Write ("
搜索结果
")

Response.Write ("")
if SearchResponse<>"" then
Response.Write SearchResponse
else
Response.Write ("")
end if
Response.Write ("
对不起,没有找到你输入的条目或关键词!
")

Response.Write ("
现在调用专业搜索引擎 http://www.yahoo.com.cn/
")

' 任选一个你喜欢的引擎.

Response.Write ("

")

End Sub
%>

[1]

如何做一个只搜索本网站的引擎?由讯客互联技术交流栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“如何做一个只搜索本网站的引擎?