% 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,shtml" ' --------------------- Place the names of the folders you don't want searched in the following line spearated by commas -------------------------- strBarredFolders = "bosatlas,sitesearch,blokkentoren,images,vriendenkring,santiago,fietsvakantie" '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 = "adminstation.htm,no_allowed.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 = False 'True = HTML Encode best for English sites \ False = no HTML Encoding best for non English sites '----------------------------------------------------------------------------------------------------------------------------------------------------- 'Initalise variables intTotalFilesSearched = 0 %>
| Website doorzocht op " & strSearchWords & ". Sorry, geen resultaten gevonden. | " 'Else Search went OK so display how many records found Else Response.Write vbCrLf & "Website doorzocht op " & strSearchWords & ". Resultaten " & 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 & " Uw zoekopdracht - " & strSearchWords & " - leverde geen resultaten op." Response.Write vbCrLf & " " Response.Write vbCrLf & " Suggesties:" 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 & "
| Gevonden <% = intTotalFilesSearched %> documenten | <% '***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** Response.Write(" Waalstad Webdesign, Nijmegen") '***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** %> |
| Sitemap | Hoofdpagina | DHTML JavaScript Menu By Milonic |
<% 'Sub procedure to do the search Public Sub SearchFile(fldObject) 'Dimension local variabales Dim filObject 'File object Dim tsObject 'Text stream object Dim subFldObject 'Sub folder object Dim RegExpObject 'RegExp Object Dim strFileContents 'Holds the contents of the file being searched Dim strPageTitle 'Holds the title of the page Dim intTitleStartPositionInFile 'Holds the start postion in the file being searched of the title Dim intTitleEndPositionInFile 'Holds the end postion in the file being searched of the title Dim strPageDescription 'Holds the description of the page Dim intDescriptionStartPositionInFile 'Holds the start postion in the file being searched of the description Dim intDescriptionEndPositionInFile 'Holds the end postion in the file being searched of the description Dim intSearchLoopCounter 'Loop counter to search all the words in the array Dim blnSearchFound 'Set to true if the search words are found 'Error handler On Error Resume Next 'Loop to search each file in the folder For Each filObject in fldObject.Files 'Check the file extension to make sure the file is of the extension type to be searched If InStr(1, strFilesTypesToSearch, fsoObject.GetExtensionName(filObject.Name), vbTextCompare) > 0 Then 'Check to make sure the file about to be searched is not a barred file if it is don't search the file If NOT InStr(1, strBarredFiles, filObject.Name, vbTextCompare) > 0 Then 'Open the file for searching Set tsObject = filObject.OpenAsTextStream 'Read in the contents of the file strFileContents = tsObject.ReadAll 'Initalise the search found variable to flase blnSearchFound = False 'If the user has choosen to search by phrase If Request.QueryString("mode") = "phrase" Then 'Search the file for the phrase If InStr(1, LCase(strFileContents), LCase(strSearchWords), 1) then 'If the search is found then set the search found variable to true blnSearchFound = True End If 'Else the search is either by all or any words Else 'If the search is by all words then initialise the search found variable to true If Request.QueryString("mode") = "allwords" then blnSearchFound = True 'Loop round to search for each word to be searched For intSearchLoopCounter = 0 to UBound(sarySearchWord) 'Search the file for the search words If InStr(1, LCase(strFileContents), LCase(sarySearchWord(intSearchLoopCounter)), 1) Then 'If the search word is found and the search is for any words then set the search found variable to true If Request.QueryString("mode") = "anywords" then blnSearchFound = True Else 'If the search word is not found and the search is for all words then set the search found variable back to false as one of the words has not been found If Request.QueryString("mode") = "allwords" then blnSearchFound = False End If Next End If 'Calculate the total files searched intTotalFilesSearched = intTotalFilesSearched + 1 'If the search found variable is true then display the results If blnSearchFound = True Then 'Calculate the total files found intTotalFilesFound = intTotalFilesFound + 1 'Check that the file shown is between the the files shown so far and the maximum files to show per page If intNumFilesShown < (intRecordsPerPage + intFileNum) and intTotalFilesFound > intNumFilesShown Then 'Calculate the number of results shown intNumFilesShown = intNumFilesShown + 1 'Read in the title of the file strPageTitle = GetFileMetaTag("