% Option Explicit %> <% '**************************************************************************************** '** Copyright Notice '** '** Web Wiz Guide Site Search Engine '** Copyright 2001-2002 Bruce Corkhill All Rights Reserved. '** '** This program is free software; you can modify (at your own risk) any part of it '** under the terms of the License that accompanies this software and use it both '** privately and commercially. '** All copyright notices must remain in tacked in the scripts and the '** outputted HTML. '** You may use parts of this program in your own private work, but you may NOT '** redistribute, repackage, or sell the whole or any part of this program even '** if it is modified or reverse engineered in whole or in part without express '** permission from the author. '** You may not pass the whole or any part of this application off as your own work. '** All links to Web Wiz Guide and powered by logo's must remain unchanged and in place '** and must remain visible when the pages are viewed unless permission is first granted '** by the copyright holder. '** This program is distributed in the hope that it will be useful, '** but WITHOUT ANY WARRANTY; without even the implied warranty of '** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR ANY OTHER '** WARRANTIES WHETHER EXPRESSED OR IMPLIED. '** You should have received a copy of the License along with this program; '** if not, write to:- Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom. '** No official support is available for this program but you may post support questions at: - '** http://www.webwizGuide.info/forum '** Support questions are NOT answered by e-mail ever! '** For correspondence or non support questions contact: - '** info@webwizGuide.com '** or at: - '** Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom '**************************************************************************************** 'Set the response buffer to true Response.Buffer = False 'Dimension global variables Dim fsoObject 'File system object Dim fldObject 'Folder object Dim sarySearchWord 'Array to hold the words to be searched for Dim strSearchWords 'Holds the search words Dim blnIsRoot 'Boolean set to true if it is the root dirctory Dim strFileURL 'Holds the path to the file on the site Dim strServerPath 'Holds the server path to this script Dim intNumFilesShown 'Holds the number of files shown so far Dim intTotalFilesSearched 'Holds the number of files searched Dim intTotalFilesFound 'Holds the total matching files found Dim intFileNum 'Holds the file number Dim intPageLinkLoopCounter 'Loop counter to display links to the other result pages Dim sarySearchResults(1000) 'Array holding the search results Dim intDisplayResultsLoopCounter 'loop counter to diplay the results of the search Dim intResultsArrayPosition 'Stores the array position of the array storing the results Dim blnSearchResultsFound 'Set to true if search results are found Dim strFilesTypesToSearch 'Holds the types of files to be searched Dim strBarredFolders 'Holds the folders that you don't want searched Dim strBarredFiles 'Holds the names of the files not to be searched Dim blnEnglishLanguage 'Set to True if the user is using English ' -------------------------- Change the following line to the number of results you wish to have on each page ------------------------------------ Const intRecordsPerPage = 10 'change this to the number of results to show on each page ' --------------------- Place the names of the files types you want searching in the following line sepeararted by commas -------------------------- strFilesTypesToSearch = "htm,html,asp" ' --------------------- Place the names of the folders you don't want searched in the following line spearated by commas -------------------------- strBarredFolders = "cgi_bin,_bin,private" 'cgi_bin and _bin have been put in here as examples, but you can put any folders in here ' ---------- Place the names of the files you don't want searched in the following line spearated by commas include the file extension ------------- strBarredFiles = "site_search.asp" 'adminstration.htm and not_allowed.asp have been put in as an examples ' -------------------- Set this boolean to False if you are not using an English language web site -------------------------------------------------- blnEnglishLanguage = True 'True = HTML Encode best for English sites \ False = no HTML Encoding best for non English sites '----------------------------------------------------------------------------------------------------------------------------------------------------- 'Initalise variables intTotalFilesSearched = 0 %>
Use this search engine to find for pages in our web site with specific information in which you are interested.
<% 'Read in all the search words into one variable strSearchWords = Trim(Request.QueryString("search")) 'If the site is in English then use the server HTML encode method If blnEnglishLanguage = True Then 'Replace any HTML tags with the HTML codes for the same characters (stops people entering HTML tags) strSearchWords = Server.HTMLEncode(strSearchWords) 'If the site is not english just change the script tags Else 'Just replace the script tag <> with HTML encoded < and > strSearchWords = Replace(strSearchWords, "<", "<", 1, -1, 1) strSearchWords = Replace(strSearchWords, ">", ">", 1, -1, 1) End If 'Slit each word to be searched up and place in an array sarySearchWord = Split(Trim(strSearchWords), " ") 'Read the file number to show from intFileNum = CInt(Request.QueryString("FileNumPosition")) 'Set the number of files shown so far to the file number read in above intNumFilesShown = intFileNum 'Create the file system object Set fsoObject = Server.CreateObject("Scripting.FileSystemObject") 'If there is no words entered by the user to search for then dont carryout the file search routine If NOT strSearchWords = "" Then 'Get the path and the root folder to be searched Set fldObject = fsoObject.GetFolder(Server.MapPath("./")) 'Read in the server path to this ASP script strServerPath = fldObject.Path & "\" 'Set to true as this is searching the root directory blnIsRoot = True 'Call the search sub prcedure Call SearchFile(fldObject) 'Reset server variables Set fsoObject = Nothing Set fldObject = Nothing 'Display the HTML table with the results status of the search or what type of search it is Response.Write vbCrLf & "| Searched the site for " & strSearchWords & ". Sorry, no results found. | " 'Else Search went OK so display how many records found Else Response.Write vbCrLf & "Searched the site for " & strSearchWords & ". Displaying Results " & intFileNum + 1 & " - " & intNumFilesShown & " of " & intTotalFilesFound & ". | " End If 'Close the HTML table with the search status Response.Write vbCrLf & "
| "
'If no results are found then display an error message
If blnSearchResultsFound = False Then
'Write HTML displaying the error
Response.Write vbCrLf & " " Response.Write vbCrLf & " Your Search - " & strSearchWords & " - did not match any files on this site." Response.Write vbCrLf & " " Response.Write vbCrLf & " Suggestions:" Response.Write vbCrLf & " " Response.Write vbCrLf & "
" Response.Write vbCrLf & " " & sarySearchResults(intDisplayResultsLoopCounter) Response.Write vbCrLf & " " Next End If 'Close the HTML table displaying the results Response.Write vbCrLf & " | "
Response.Write vbCrLf & "
"
Response.Write vbCrLf & "
| "
Response.Write vbCrLf & "
| Searched <% = intTotalFilesSearched %> documents in total. | <% '***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** Response.Write(" Powered By - www.webwizGuide.info") '***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** %> |
![]() | |
| Gloria and Emma at Tappan Lake. |