<%@ Language=VBScript %> <% Option Explicit %> <% Response.Buffer = TRUE %> <% function ereg_replace(tx,rg,ch) set regEx = New RegExp regEx.IgnoreCase = False regEx.Global = True regEx.Pattern = rg ereg_replace = regEx.replace(tx,ch) end function function htmlspecialchars(ch) ch = replace(ch,"&","&") ch = replace(ch,"""",""") ch = replace(ch,"'","'") ch = replace(ch,"<","<") ch = replace(ch,">",">") htmlspecialchars = ch end function function notag(txt) set regEx = New RegExp regEx.Global = True regEx.Pattern = "<[^>]+>" notag = regEx.replace(txt,"") end function %> <% dim action, blork, start, choix, caractere_special_code, caractere_special, body, body2, body3, result dim vientde, gaston, form_recherche, subFolderObj, x, y, fold, fold2, finbarre, folder_name dim maxmots, longueur_blork, blork2, blork3, regEx, url, guillemet, apostrophe dim pourvoir, finstart, prevbarre, nextbarre, nb_barre, compte_affichage, rs, barre dim driveObj, folderObj, chemin, F, SF, file, Files, la, la2, lecture, pos_body dim recherche, change_recherche, trouve, gauche, droite, le, le2, lu, count, lo, ly blork = "" form_recherche="

Nouvelle recherche :
" form_recherche = form_recherche & "" form_recherche = form_recherche & "" form_recherche = form_recherche & "
" form_recherche = form_recherche & "
" %> <% vientde = Request.ServerVariables( "HTTP_REFERER" ) gaston = instr(vientde, "recherche.asp") if gaston = 0 then response.write(form_recherche) %> <% else %> <% caractere_special_code=array("à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","î","ï","ô","ö","ù","ú","û","ü","&"," ") %> <% caractere_special=array("à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","î","ï","ô","ö","ù","ú","û","ü","&", " ") %> <% action = Request.QueryString("action") blork = Request.QueryString("blork") start = Request.QueryString("start") choix = Request.QueryString("choix") if(maxmots="") then maxmots="20" end if if(maxipage="") then maxipage=10 end if if(start="" or start="0" ) then start="1" end if longueur_blork=len(blork) blork=trim(blork) blork = ereg_replace(blork," +"," ") blork3 = blork blork = LCASE(blork) blork2 = htmlspecialchars(blork) if(longueur_blork<3) then response.write(form_recherche) response.write("Votre recherche doit comporter au moins trois caractères.
") %> <% else %> <% response.write(form_recherche) count=0 %> <% dim encore() dim encore2() dim encore3() dim encore4() count = 0 folder_name = "html" chemin= Server.MapPath("..") set driveObj = Server.CreateObject("Scripting.FileSystemObject") Set folderObj = driveObj.GetFolder(chemin) Set SF = FolderObj.SubFolders For Each F In SF if (F.name=folder_name) then Set file = F.Files For Each Files In file set lecture = driveObj.OpenTextFile(Files,1,false) if Files.Type = "HTML Document" or Files.Type = "HTM Document" or Files.Type = "HTML File" or Files.Type = "HTM File" then la = lecture.readAll la2 = la la = LCASE(la) body = "=70) then droite = (recherche + longueur_blork) gauche = recherche - 70 lu = 70 else droite = (recherche + longueur_blork) gauche = 1 lu = recherche-1 end if if (recherche<>0) then lo = MID(le2,gauche,lu) guillemet = chr(34) apostrophe = "#$@+*¨m" lo = replace(lo,guillemet,apostrophe) redim preserve encore(count) encore(count) = lo ly = MID(le2,droite,lu) ly = replace(ly,guillemet,apostrophe) redim preserve encore2(count) encore2(count) = ly redim preserve encore3(count) encore3(count) = F.name redim preserve encore4(count) encore4(count) = Files.name count = count + 1 end if end if Next lecture.Close end if Next set lecture = nothing set file = nothing set SF = nothing set folderObj = nothing set driveObj = nothing if (start="1" and count=0 ) then start="0" end if pourvoir=Cint(start)+maxipage-1 if (pourvoir>count)then pourvoir=count end if finstart=count - maxipage+1 prevbarre=Cint(start)-maxipage nextbarre=Cint(start)+maxipage nb_barre=1 compte_affichage=Cint(start) rs=" résultat trouvé " if (count >1) then rs=" résultats trouvés " end if %> <%= "Résultats de votre recherche pour " & blork2 & "
" & count & rs & " - Affichage des résultats " & start & " à " & pourvoir %> <% if(count=0) then response.write(form_recherche) end if if (count >0) then for y=Cint(start - 1) to ubound(encore) if (compte_affichage >= Cint(start) and compte_affichage < nextbarre) then response.write("

")%> - <% = encore4(y) %>
<% encore(y) = replace(encore(y), apostrophe, guillemet) encore2(y) = replace(encore2(y), apostrophe, guillemet) %> <%= "..." & encore(y) & "" & blork3 & "" & encore2(y) & "..." %> <% compte_affichage = compte_affichage +1 end if next end if if (count > maxipage) then response.write("


") if (Cint(start)<>1) then %> << Début < Page précédente ( <% else response.write("<< Début < Page précédente (") end if for barre=1 to count Step maxipage finbarre=(count-barre) %> <%= nb_barre %> <% nb_barre = nb_barre + 1 next if (Cint(start) < finstart) then %> ) Page suivante > Fin >> <% else response.write(") Page suivante > Fin >>") end if response.write("

") end if if (count=0) then response.write("
Votre recherche sur le terme '" & blork2 & "' n'a donné aucun résultat. Essayez d'élargir votre recherche en y mettant moins de mots ou vérifiez son orthographe.
") else response.write(form_recherche) end if %> <% end if end if %>