|Add a search utility to your site|
This search utility will allow you to search for terms or phrases within your site, and the resulting page will show your visitors the title of the page and a link to it.
You only need to include the form bellow in your page:
<form method="POST" action="/cgi-bin/searchfiles.asp">
<table border=0 cellpadding=5 bgcolor=AAAAAA><tr>
Search term or phrase <input type=text name=term size=15> <input type=submit value="search"></td>
And you will need to create a file with the content in the table bellow
named searchfiles.asp in the corresponding
directory. Active Server Pages must be available in the server. Instructions are in the bottom.
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"
if instr(SearchTerm,Novalid)=0 then
Response. Write ("<CENTER><H2>Search results</H2></CENTER>")
Wfile = f1.name
if instr(ct2,SearchTerm2)>0 then
if instr(ct,"</title>")>0 then
SearchResponse= SearchResponse +"<TR><TD>"+ ct + "</TD><TD
ALIGN=CENTER VALIGN=MIDDLE>" + " <A HREF=" + "/" + FolderName + "/"
+ Wfile +"> More </A></TD></TR>"
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>")
You may include the terms you do not want to be searched in the variable "Novalid". In case a term included in "Novalid" is request, write your response in the variable "NovalidResponse".
"Search results" is the text which will be shown in the top of the search results page.
"FolderName" is the directory you want to search. Only ".htm" and ".html" files in this directory will be searched. Subdirectories are not search. In case you want to search your top directory, set FolderName="". This script is only useful in top directories only. I do not recommend to check more than 50 files (Try to be friendly with your server!)
This script will show as a response a list of the titles of pages
with the requested term of phrase.