<% if Request("Search") <> "" Then %>


Search For : '<%=Request("Search")%>'
<% ' ' Buscador Simple. Autor Jorge Cisneros ' jorgeci@hotmail.com ' Const fsoForReading = 1 Dim objFile, objFolder, objSubFolder, objTextStream Dim bolCase, bolFileFound Dim strDeTag, Ext, strFile, strContent, strRoot, strTag, strText, strTitle, strTitleL Dim reqLength, reqNumber, count strFile = ".asp .htm .html .js .txt .css" strRoot = "../english" strText = Request("Search") bolCase = 1 reqNumber = 10 reqLength = 200 Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(Server.MapPath(strRoot)) CurURL= "http://" & Request.serverVariables("SERVER_NAME") & "/english" CurPath = objFolder schSubFol(objFolder) For Each objSubFolder In objFolder.SubFolders schSubFol(objSubFolder) Next if Not bolFileFound Then Response.Write "Sorry! No Records Found For This Search." if bolFileFound Then Response.Write "End Of Search!" Set objTextStream = Nothing Set objFolder = Nothing Set objFSO = Nothing Sub schSubFol(objFolder) For Each objFile In objFolder.Files if Count + 1 > reqNumber or strText = "" Then Exit Sub if Response.IsClientConnected Then 'Abrir solo si es archivo conocido strext = right(objFile.Name,3) if instr(1,strFile,strext) > 0 Then Set objTextStream = objFSO.OpenTextFile(objFile.Path,fsoForReading) strContent = objTextStream.ReadAll if InStr(1,strContent,strtext) > 0 Then postitle = InStr(1, strContent, "",1) if postitle > 0 Then strTitle = Mid(strContent, postitle + 7, InStr(1, strContent, "", 1) - (postitle + 7)) Else strTitle = "No Title" End if Count = Count + 1 Response.Write "

"& Count &" - " & strTitle & "

" strTitleL = InStr(1, strContent, "", 1) - InStr(1, strContent, "", 1) + 7 strDeTag = "" bolTagFound = False Do While InStr(strContent, "<") bolTagFound = True strDeTag = strDeTag & " " & Left(strContent, InStr(strContent, "<") - 1) strContent = MID(strContent, InStr(strContent, ">") + 1) Loop strDeTag = strDeTag & strContent if Not bolTagFound Then strDeTag = strContent if reqLength = "0" Then Response.Write obt_url(objFile.Path) & "</DD></DL>" Else Response.Write Mid(strDeTag, strTitleL, reqLength) & "...<BR><I><FONT SIZE='2'>URL: " & obt_url(objFile.Path) & " - Ultima modificación: " & objFile.DateLastModified & " - " & FormatNumber(objFile.Size / 1024) & "Kbytes</FONT></I></DD></DL>" End if bolFileFound = True End if objTextStream.Close End if End if Next End Sub function Obt_Url (nompath) obt_url = CurUrl +"/"+ right(nompath,len(nompath) - len(curpath)-1) End function %> <% End if %> </P> </BODY> </HTML>