Ver Mensaje Individual
  #11 (permalink)  
Antiguo 06/04/2005, 04:41
Suki
 
Fecha de Ingreso: abril-2005
Mensajes: 5
Antigüedad: 20 años, 1 mes
Puntos: 0
os paso el codigo del fichero asp:

<%@language="VBScript"%>

<html>

<head>
<title>Buscar datos</title>
</head>
<body bgcolor="#FFFFCC">
<!-- Esta linea nos dira los resultados obtenidos con la palabra clave -->


<%
SearchTerm = request.form("Palabra")

Novalid=" a b c d e f g h i j k l m n o p q r s t u v w x y z si no and more"
NovalidResponse ="Inténtelo de nuevo. Su término de Búsqueda no es correcto"


if instr(SearchTerm,Novalid)=0 then
Response.Write ("<CENTER><H2>Resultado de la Busqueda</H2></CENTER>")
'FolderName= "Direccion donde se ubican los ficheros sobre los que realizo la busqueda"


FolderName="/pagina-web/HTM/asuntos 05/"
FolderName=server.htmlencode(FolderName)

ShowList()
else
Response.Write NovalidResponse
End if

SearchResponse=""
%>

<%
Sub ShowList()


FolderToCheck = server.mappath("\") &"/" & FolderName & "/"





Dim fs, f, f1, fc, s, i, C, Complete

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(FolderToCheck)
Set fc = f.Files
For Each f1 in fc

Wfile = f1.name

'generacion del nombre del fichero para el link. Puesto que puede tener espacios
i=0
complete=wfile
C=split(complete," ",-1,1)
while (right(C(i),4)<>".doc")
if (i=0) then
complete=C(0)
else
complete=complete + "%20" + C(i)
end if
i= i + 1
wend
if i>0 then
complete=complete + "%20" + C(i)
end if




if right(wfile, 4)=".asp" OR right(wfile, 4)=".doc" then
Wfile2 = FolderToCheck & Wfile

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile(Wfile2)
ct = a.ReadAll
a.close
ct2=lcase(ct)
SearchTerm2 = lcase(SearchTerm)
FichName=lcase(Wfile)
if instr(FichName,SearchTerm2)>0 then



SearchResponse= SearchResponse & "<TR><TD>"& Wfile & "</TD><TD ALIGN=""CENTER"" VALIGN=""MIDDLE"">" & "<A Href="" FILE://c:/inetpub/wwwroot/Pagina-web/HTM/ASUNTOS 05/10 enero revision.doc"">"& "VER" & "</A></TD></TR>"

else
'Este trozo ni caso, todavia no esta depurado pero no influye

SearchTerm2=Server.htmlencode(SearchTerm2)
if instr(ct2,SearchTerm2)>0 then

if instr(ct,"</title>")>0 then
longitud=instr(ct,"</title>")
longitud=longitud -1
ct=left(ct,longitud)
longitud2=len(ct)
longitud=instr(ct,"<title>")
longitud=longitud2 -longitud -6
ct=right(ct,longitud)
else
if instr(ct,"</TITLE>")>0 then
longitud=instr(ct,"</TITLE>")
longitud=longitud -1
ct=left(ct,longitud)
longitud2=len(ct)
longitud=instr(ct,"<TITLE>")
longitud=longitud2 -longitud -6
ct=right(ct,longitud)
end if
end if


'SearchResponse= SearchResponse +"<TR><TD>"+ ct + "</TD><TD ALIGN=CENTER VALIGN=MIDDLE>" + " <A HREF="+FolderName + "/" + Wfile +"> VER </A></TD></TR>"
longitud=0
ct=""

end if
end if
end if

Next

Response.Write ("<HTML><HEAD><TITLE>RESULTADOS</TITLE></HEAD><BODY BGCOLOR=FFFFFF><CENTER>")

Response.Write ("<TABLE BORDER=0 WIDTH=550><TR><TD BGCOLOR=C0C0C0><FONT SIZE=5><B>Ficheros disponibles</B></FONT></TD></TR></TABLE>")

Response.Write ("<TABLE BORDER=0 WIDTH=550>")
if SearchResponse<>"" then
Response.Write SearchResponse
else
Response.Write ("<TR><TD>El Termino Especificado o frase, no ha producido ningún resultado</TD></TR>")
end if
Response.Write ("</TABLE>")

Response.Write ("<TABLE BORDER=0 WIDTH=550><TR><TD BGCOLOR=C0C0C0 ALIGN=RIGHT><FONT SIZE=1></FONT></TD></TR></TABLE>")

Response.Write ("</CENTER></BODY></HTML>")

End Sub



%></body></html>