%Option Explicit%> <% Dim arrFolderExcludes Dim arrFileExcludes arrFolderExcludes = Array("images") arrFileExcludes = Array("text.htm", "strategic_3.html")', "revision.htm") %> <% 'IF NOT Trim(Request("searchstring")) = "" THEN Const ForReading = 1 Dim searchstring searchstring = trim(request("searchstring")) Dim i dim searchArray searchstring = LCase(trim(Replace(searchstring, ",", " "))) searchArray = split(searchstring, " ") Dim fso1 set fso1 = Server.CreateObject("Scripting.FileSystemObject") Dim startfolder startfolder = fso1.GetFolder(Server.MapPath(".")) set fso1 = nothing If mid(startfolder,Len(startfolder)-1) <> "\" Then startfolder = startfolder & "\" End If Dim numResults numResults = 0 Sub LoopDirectory(path) Dim FSO Set FSO = Server.CreateObject("Scripting.FileSystemObject") Dim f, fc, f1, thisfile set f = FSO.GetFolder(path) Set fc = f.Files on error resume next For Each f1 in fc Dim File, line, extension thisfile = f1.name extension = trim(Mid(thisfile, InStrRev(thisfile, ".") + 1)) Dim exclude exclude = false for i = 0 to UBound(arrFileExcludes) if LCase(thisfile) = LCase(arrFileExcludes(i)) then exclude = true end if next If InStr(LCase(extension), "htm") > 0 and not exclude Then Dim size size = CInt(UBound(searchArray)) Dim arrResults(0) Redim arrResults(size) If FSO.FileExists(path&thisfile) Then Set File = FSO.OpenTextFile(path&thisfile, ForReading) Dim wholeFile, tempFile wholeFile = File.ReadAll wholeFile = replace(wholeFile, vbTab, " ") wholeFile = replace(wholeFile, chr(9), " ") wholeFile = replace(wholeFile, " ", " ") while InStr(wholeFile, " ") > 0 wholeFile = replace(wholeFile, " ", " ") wend Dim tStart tStart = LCase("""Heading1""") Dim titleS, titleE, title, start title = "" titleS = 1 titleE = 0 start = 1 while title = "" and titleS > 0 titleS = instr(start, LCase(wholeFile), tStart) if titleS > 0 then titleS = instr(instr(start, LCase(wholeFile), tStart), LCase(wholeFile), ">") titleE = instr(titleS+1, LCase(wholeFile), "") end if if not (titleS = 0 or titleE = 0) then titleS = titleS + 1 title = Trim(Mid(wholeFile, titleS, titleE-titleS)) if trim(title) = "" or trim(title) = " " then start = titleE title = "" end if end if wend if trim(title) = "" then title = thisFile end if Dim x, x1, tag ' remove
.. x = 1 while x > 0 x = InStr(LCase(wholeFile), ""), wholeFile, ">")+1 if not (x = 0 or x1-1 = 0) then tag = Mid(wholeFile, x, x1-x) wholeFile = Replace(wholeFile, tag, "") end if wend ' remove x = 1 while x > 0 x = InStr(LCase(wholeFile), "
|
||||||||
![]() |
||||||||
|
![]() |
|||||||
|
|
||||||||
|
|
||||||||