<%
Const fsoForReading = 1
Dim strSearchText
strSearchText = Request("txtSearch")
'Now, we want to search all of the files
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Dim objFile, objTextStream, strFileContents, bolFileFound
Dim objFolder, i
i = 1
bolFileFound = False
foldernames = "root"
dim foldername, j
foldername = split(foldernames, ",")
'Response.Write(ubound(foldername))
'Response.end
for j = 0 to ubound(foldername)
searchfiles foldername(j), strSearchText
'Response.Write(foldername(j))
next
function searchfiles(foldername, strSearchText)
if foldername = "root" then
Set objFolder = objFSO.GetFolder(Server.MapPath("/"))
else
Set objFolder = objFSO.GetFolder(Server.MapPath("/")+"\"+foldername)
Response.Write objfolder
end if
For Each objFile in objFolder.Files
If Response.IsClientConnected then
Set objTextStream = objFSO.OpenTextFile(objFile.Path,fsoForReading)
strFileContents = objTextStream.ReadAll
If InStr(1,strFileContents,strSearchText,1) then
if foldername = "root" then
response.write ("
Search Result for '"& strSearchText &"'
")
foldername = ""
end if
response.write("
")
response.write("
")
if objFile.Name <> "contactmail.asp" and objFile.Name <> "curveleft.jpg" and objFile.Name <> "dot_o.gif" and objFile.Name <> "hr01.gif" and objFile.Name <> "MAINANI.gif" and objFile.Name <> "mainpage-mix.jpg" and objFile.Name <> "savereg.asp" and objFile.Name <> "savesatisreport.asp" and objFile.Name <> "savesuggestion.asp" and objFile.Name <> "md.jpg" and objFile.Name <> "style.css" then
Response.Write " " & objFile.Name & " "
end if
i = i + 1
bolFileFound = True
End If
objTextStream.Close
End If
Next
end function
if Not bolFileFound then
response.write ("
Search Result for'"& strSearchText &"'
")
response.write("
")
Response.Write "
No matches found...
"
end if
Set objTextStream = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
%>