PDA

View Full Version : set variables are not being recognised ????


chris_angell
09-30-2002, 11:22 AM
hello I found this code, but when I put it into place it is not working, well it search's fine, but there is and option where you can ban certain files and folders from not being searched...

strBarredFiles = "adminstation.htm,no_allowed.asp"
strBarredFolders = "temp,temp1"

but when I publish the code, and search ??? they are still added to the search list, is there an easy reason why this is going wrong, I am stuck ???


here is the code :)

<% Option Explicit %>
<%


'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 = 20 '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 = "temp,temp1" '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 = True 'True = HTML Encode best for English sites \ False = no HTML Encoding best for non English sites

'-----------------------------------------------------------------------------------------------------------------------------------------------------


'Initalise variables
intTotalFilesSearched = 0

%>

part 2 too come

chris_angell
09-30-2002, 11:27 AM
if you click here you can look at the code :)

thank you ....

http://www.connectonlinepreview.co.uk/_chris\code\Search_Site/search_code.htm

whammy
09-30-2002, 12:06 PM
Apparently you didn't post a relevant part of the code, because I can't find the strings

strBarredFiles
strBarredFolders

referenced anywhere else in the scripts you posted.

:confused:

chris_angell
09-30-2002, 12:13 PM
I can't believe I did that, oppps...

http://www.connectonlinepreview.co.uk/_chris/code/Search_Site/search_code.htm

but if you go to the link above and refresh.. it should be there,,

thanks..


:o

chris_angell
10-02-2002, 03:25 PM
what do you think my best move is now ??? should I look for another search script..


is this one just too hard to mend ???


if you could help on where I could find one.. this would help..


many thanks :thumbsup:

whammy
10-04-2002, 04:23 AM
I'm not sure... I might look at what they are doing and rewrite the search script personally - but to be honest I haven't had the time to go through it line by line... from what I see it looks ok (minus the bad spelling), and I don't see any obvious errors...

... although, considering the developer's obvious habit of typing inaccurately, there might be a misspelled variable somewhere in the code :confused:

I wish I could help more personally, but it might even be a good exercise for you to figure out what they are doing, and rewrite the script yourself.

As a matter of fact, something like that shouldn't be very hard... check out:

http://www.w3schools.com/asp/asp_ref_filesystem.asp

and

http://www.w3schools.com/asp/asp_ref_textstream.asp


If you master what is shown there, you will see how it could be very easy to write such a script from scratch. :)