Ir para conteúdo
Fórum Script Brasil
  • 0

Erro Urgente


Flavio Diniz

Pergunta

12 respostass a esta questão

Posts Recomendados

  • 0
<%@ Language=VBScript %>

<%

Option Explicit
Response.Buffer = True

' Set up some FileSystem objects.
dim objFS, objFolder, objFiles, File, FileName, objCheckFile, strSitePath
set objFS = server.CreateObject("Scripting.FileSystemObject")

dim strListofFiles, arrFileList, strPageTitle, iReturnCount
dim objFolders

strListofFiles = ""
iReturnCount = 0

' The search values, search space, and the return value
dim strKeyWord, strFileContents, returnValue, arrKeyWords
dim bKeyWordFound, i, j

' Get the Physical path to the current directory
strSitePath = Server.MapPath(".")

' Grab the keyworlds and split them into an array
strKeyWord = Trim(request("txtKeyWord"))
arrKeyWords = split(strKeyWord," ")

' Get the list of files.
Set objFolder = objFS.GetFolder(strSitePath)


' Sub that grabs all the ".htm" & ".html" files in the given folder and
' recurses through all subfolders. 
sub getCompleteFileList(inFolder, Path)

dim oFiles, oFolders, Folder, sPath, indice



' Get all the files and subfolders.
Set oFiles = inFolder.Files
Set oFolders = inFolder.SubFolders

' If we have a subfolder we need the partial path
if (Path <> "") then
sPath = Path + "\"
end if

' Add each ".htm" & ".html" file to the list
For Each File in oFiles
FileName = File.Name

if((Lcase(right(FileName,4)) = ".htm") OR (Lcase(right(FileName,5)) = ".html")) then
if (strListofFiles = "") then
strListofFiles = sPath + FileName
else 
strListofFiles = strListofFiles + "," + sPath + FileName
end if 
end if
Next

' Check all the subfolders for ".htm" & ".html" files
For Each Folder in oFolders
if (Folder.Name <> "images" AND Folder.Name <> "stats") then 
call getCompleteFileList(Folder, sPath + Folder.Name)
end if
Next

' Clean up 
set File = Nothing
set oFiles = Nothing
set Folder = Nothing
set oFolders = Nothing

end sub


%>
<html>
<head>
<title>busca </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0">

<table border="0" cellpadding="0" cellspacing="0" width="779" height="70">
  <tr>
          <td valign="top" height="70">
          <IFRAME src="home/barra_menu_index.htm" frameBorder=0 width="779" 
  scrolling=no height="97" target="_top" ></IFRAME></td>
  </tr>
      </table>
<table cellspacing=7 cellpadding=2 border=0 width="100%">
<tbody> 
<tr> 
<td valign=top align=middle> 
<table cellspacing=0 width="100%" border=0>
<tbody> 
<tr> 
<td align=middle bgcolor=#3366cc> 
<table cellspacing=0 cellpadding=2 width="100%" border=0>
<tbody> 
<tr> 
<td align=middle bgcolor=#ffffff> 
<table cellspacing=0 width="757" border=0>
<tbody> 
<tr bgcolor="#F2F2F2"> 
<td align=middle bgcolor="#7CAA2F" width="753"> 
<div align="left"><b>Busca Resultados</b></div>
</td>
</tr>
<tr bgcolor="#F2F2F2"> 
<td align=middle bgcolor="#FFFFFF" width="755"> 
<div align="left"></div>
<p align="left"> 
<!-- 
The Start of the search specific html code. 
It needs a look and feel update. 
//-->
</p>
<table width="95%" border="0" cellspacing="1" cellpadding="1" align="center">
<tr bgcolor="#330099"> 
<td bgcolor="#FFFFFF"> 
<div align="left"><b><font color="#666666">Você Pesquisou:</font><font color="#000000">
  </font></b><font color="#FFFFFF"><font color="#FF0000"><%= strKeyWord%></font></font></div>
</td>
</tr>
<%
' Only to the search if we got at least one keyword
if (strKeyWord <> "") then

' Call the sub that gets all the files 
call getCompleteFileList(objFolder, "")

' Take the big ole string the contains all the files seperated by commas and chop it up.
arrFileList = split(strListofFiles,",")

For i=0 to UBound (arrFileList)

' Open the current file and read everything into a single string.
' If the files are huge this could eat a lot or resources.
Set objCheckFile = objFS.OpenTextFile(strSitePath + "\" + arrFileList(i),1,false,0)
strFileContents = objCheckFile.ReadAll

' Default the search flag to false.
bKeyWordFound = false

' For each keyword entered search the file.
for j = 0 to UBound(arrKeyWords) 
returnValue = InStr(1,strFileContents,arrKeyWords(j),1)

' If the returnValue isn't zero the keyword was found
' Set the search flage to true and short cut out of the loop.
if (returnValue <> 0) then
bKeyWordFound = true
j = UBound(arrKeyWords)
end if
next

' If a keyword was found include this file in the list.
if (bKeyWordFound) then

' Keep track of the number of results and grab the title of the page for the search display 
iReturnCount = iReturnCount + 1

dim startChar, endChar
startChar = InStr(1,strFileContents,"<title>",1)
endChar = InStr(1,strFileContents,"</title>",1)

if (startChar = 0 OR endChar = 0 OR ((startChar + 7) > (endChar - 7))) then
%>
<tr> 
<td><font face="Arial, Helvetica, sans-serif" size="2"><a href="<%= arrFileList(i) %>"><%= arrFileList(i) %></a> <%= arrFileList(i) %></font></td>
</tr>
<% 
else 
strPageTitle = mid(strFileContents,InStr(1,strFileContents,"<title>",1) + 7, InStr(1,strFileContents,"</title>",1) - InStr(1,strFileContents,"<title>",1) - 7)

if (strPageTitle = "") then
strPageTitle = arrFileList(i)
end if
%>
<tr> 
<td><font face="Arial, Helvetica, sans-serif" size="2"><a href="<%= arrFileList(i) %>"><%= strPageTitle%></a> <%= arrFileList(i) %></font></td>
</tr>
<% 
end if
end if

' Close the file so we can open another one. 
objCheckFile.Close
Next

end if
%>
<tr> 
<td><font face="Arial, Helvetica, sans-serif" size="2" color="#999999"><%= iReturnCount%> Paginas
  encontradas</font></td>
</tr>
<tr> 
<td>&nbsp;</td>
</tr>
<%

' Clean up all the objects used.
set objCheckFile = Nothing
set File = Nothing
set objFiles = Nothing
set objFolder = Nothing
set objFS = Nothing

%>
</table>
<!-- the end of the search html -->
</td>
</tr>
</tbody> 
</table>
</td>
</tr>
</tbody> 
</table>
</td>
</tr>
</tbody> 
</table>
</td>
</tr>
</tbody> 
</table>
<p>&nbsp;</p>
<table border="0" width="779" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#006633">
      <p align="center"><font face="Verdana" size="1" color="#FFFFFF">Todos os
      direitos reservados: <a href="index.asp"><font color="#FFFFFF">www.culturacariri.com.br</font></a></font></td>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="779">
  <tr>
    <td>
      <p align="right"><font face="Verdana" size="1">Produzido por: <b>
      <a target="_blank" href="http://www.origemstudio.hpg.com.br">
      <font color="#000000">ORIGEM ESTÚDIO</font></a></b></font></td>
  </tr>
</table>
</body>
</html>

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,3k
×
×
  • Criar Novo...