How to create an engine that only searches for this website?
Searchfiles.html
<Html>
<Head>
<Title> Alibaba Cloud's search engine </title>
</Head>
<Body>
<Form method = "POST" action = "cgi-bin/searchfiles. asp">
<Table border = "0" cellpadding = "5" bgcolor = "# C2E7E3">
<Tr>
<Td align = "center"> enter an entry or keyword <input type = "text" name = "term" size = "15"> <input type = "submit" value = "Search"> </td>
</Tr>
</Table>
</Form>
</Body>
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 = "the content you entered is too simple. Please return and try again! "
If instr (SearchTerm, Novalid) = 0 then
Response. Write ("<CENTER> <H2> Search Result </H2> </CENTER> ")
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, "</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 ("
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> sorry, the entry or keyword you entered is 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> now call A professional search engine <a href = http://www.yahoo.com.cn /</A> </FONT> </td> </tr> </TABLE> ")
'Choose one of your favorite engines.
Response. Write ("</CENTER> </body>
End Sub
%>
Note: For more exciting tutorials, please follow the help houseWebpage Design tutorialTopic,