<%@ Language=VBScript %> <% Option Explicit %> <% ConnectToDB(".") %> <% function CarryQueryString() dim I for I = 1 to Request.QueryString.Count if Request.QueryString.Key(I) <> "p" then CarryQueryString = CarryQueryString & "&" & Request.QueryString.Key(I) & "=" & Request.QueryString.Item(I) end if next end function sub BuildNavBar() if NumPages >= 2 then %>
<% dim Istart 'début the la liste de navigation dim Iend 'fin de la liste de navigation if ActPage > 1 then %>Précédent<% end if 'début de navigation if ActPage > 5 then Istart = ActPage - 5 if Istart > Numpages - 10 then iStart = Numpages - 10 else Istart = 1 end if 'fin de navigation if Actpage < NumPages - 5 then Iend = Actpage + 5 if Iend < 11 then Iend = 11 else Iend = NumPages end if for I = Istart to Iend if I = Actpage then %><%=I%><% else %> <%=I%> <% end if if I <> Iend then Response.Write " - " end if next if Actpage < NumPages then %>Suivant<% end if %>
<% end if end sub dim vSection, vParent dim RightBar RightBar = true %> Aînés Hébergement - Recherche générale <%'**** ce bout de table doit être présent dans tout les headers%>
  Moteur de recherche
 Mots clés : ">  
checked <% end if %> > Articles checked <% end if %> > Revue Nouveau! checked <% end if %> > Forum checked <% end if %> > Liens
Pour faire une recherche de résidence Cliquez ici

<% Function SearchQueryPlus(vField, vValues) SearchQueryPlus = "(" & vField & " like '" & vValues & "' OR " & vField & " like '% " & vValues & "' OR " & vField & " like '" & vValues & " %' OR " & vField & " like '% " & vValues & " %')" end function Function SearchKeywordsPlus(vField, vValues) SearchKeywordsPlus = "(" & vField & " like '" & vValues & "' OR " & vField & " like '%," & vValues & "' OR " & vField & " like '" & vValues & ",' OR " & vField & " like '%," & vValues & ",%')" end function if trim(Request.QueryString("txtSearch")) <> "" then dim vTimer vTimer = Timer dim KeyArr, aKey, aWord, RSK, ListKey, ListWord, I set RSK = Server.CreateObject("ADODB.Recordset") dim keys KeyArr = Split(trim(dbl(Request.QueryString("txtSearch"))), " ") 'Setting up des keywords redim aKey(Ubound(KeyArr)) 'tableau contenant le # des keywords redim aWord(Ubound(KeyArr)) 'tableau contenant les keywords 'ces 2 variables servent au compte de pertinence d'un résultat ListKey = "" ListWord = "" 'tiens une liste facile d'accès pour voir si le mot que l'on a est déja dedans for I = 0 to Ubound(KeyArr) 'copie des requêtes de l'utilisateur aKey(I) = 0 aWord(I) = KeyArr(I) ListWord = ListWord & KeyArr(I) & " " ListKey = ListKey & KeyArr(I) & " " next 'ici on va chercher tout les keywords qui pourraient s'apparenter à celui concerné for I = 0 to UBound(KeyArr) strSQL = "SELECT ID, Mot " & _ "FROM Thesaurus " & _ "WHERE ID in (SELECT Parent FROM Thesaurus WHERE Mot = '" & KeyArr(I) & "') " 'trouve la ctégorie du mot strSQL = strSQL & "OR Mot = '" & KeyArr(I) & "' " 'trouve le mot strSQL = strSQL & "OR Parent in (SELECT ID FROM Thesaurus " strSQL = strSQL & " WHERE ID in (SELECT Parent FROM Thesaurus " strSQL = strSQL & " WHERE Mot = '" & KeyArr(I) & "')) " 'trouve les frère du mot strSQL = strSQL & "OR Parent in (SELECT ID FROM Thesaurus " strSQL = strSQL & " WHERE Mot = '" & KeyArr(I) & "');" 'trouve les enfants du mot RSK.Open strSQL, CN do while not RSK.EOF redim preserve aKey(Ubound(aKey) + 1) redim preserve aWord(Ubound(aWord) + 1) aKey(Ubound(aKey)) = RSK.Fields("ID") aWord(Ubound(aWord)) = RSK.Fields("Mot") ListKey = ListKey & RSK.Fields("ID") & " " ListWord = ListWord & RSK.Fields("Mot") & " " RSK.MoveNext loop RSK.Close next ListWord = Trim(ListWord) ListKey = Trim(ListKey) strSQL = "" ' pour compter le nombre de mot dans une série de fields : ((Len(Titre & ' ' & TextFormat) - Len(Replace(Titre & ' ' & TextFormat, 'le', ''))) / len('le')) 'les articles/sections if Request.QueryString("chkArt") = "on" then strSQL = strSQL & "SELECT '3;4;5;6' AS vCount, " & _ "'Section' AS vTable, " & _ "ID_Section as vID, " & _ "Titre AS v1, " & _ "TextFormat AS v2," & _ "Auteur AS v3, " & _ "TitreA AS v4, " & _ "Email AS v5, " & _ "ID_MenuItem AS v6 " & _ "FROM tbl_Section WHERE Display AND (" for I = 0 to Ubound(aWord) strSQL = strSQL & "(" & SearchQueryPlus("Titre", aWord(I)) & " OR " & SearchQueryPlus("TextFormat", aWord(I)) & ")" if Ubound(aKey) >= I + 1 then if aKey(I + 1) = 0 then strSQL = strSQL & " AND " else if aKey(I) = 0 then strSQL = strSQL & ") OR (" else strSQL = strSQL & " OR " end if end if end if next strSQL = strSQL & ") UNION " end if 'les articles de la revue if Request.QueryString("chkRev") = "on" then strSQL = strSQL & "SELECT '4;5;8|' & Keywords AS vCount, " & _ "'Article' AS vTable, " & _ "ID as vID, " & _ "ID_Jou AS v1, " & _ "Nom_Jou AS v2, " & _ "Titre AS v3, " & _ "Revue AS v4, " & _ "Pages AS v5, " & _ "Description AS v6 " & _ "FROM Articles INNER JOIN Journalistes ON Articles.Journaliste = Journalistes.ID_jou WHERE (" for I = 0 to Ubound(aWord) strSQL = strSQL & "(" & SearchQueryPlus("Titre", aWord(I)) & " OR " & SearchQueryPlus("Article", aWord(I)) & " OR " & SearchQueryPlus("Description", aWord(I)) & " OR " & SearchQueryPlus("Nom_Jou", aWord(I)) & " OR " & SearchKeywordsPlus("Keywords", aKey(I)) & ")" if Ubound(aKey) >= I + 1 then if aKey(I + 1) = 0 then strSQL = strSQL & " AND " else if aKey(I) = 0 then strSQL = strSQL & ") OR (" else strSQL = strSQL & " OR " end if end if end if next strSQL = strSQL & ") UNION " end if 'les articles/sections if Request.QueryString("chkFR") = "on" then strSQL = strSQL & "SELECT '3;4;5' AS vCount, " & _ "'Forum' AS vTable, " & _ "frMess.ID as vID, " & _ "Titre AS v1, " & _ "Message AS v2," & _ "Username AS v3, " & _ "IIF(HideEmail, '', Email) AS v4, " & _ "frUser.ID AS v5, " & _ "vDate AS v6 " & _ "FROM frMess INNER JOIN frUser ON frUser.ID = frMess.ID_User WHERE (" for I = 0 to Ubound(aWord) strSQL = strSQL & "(" & SearchQueryPlus("Titre", aWord(I)) & " OR " & SearchQueryPlus("Message", aWord(I)) & ")" if Ubound(aKey) >= I + 1 then if aKey(I + 1) = 0 then strSQL = strSQL & " AND " else if aKey(I) = 0 then strSQL = strSQL & ") OR (" else strSQL = strSQL & " OR " end if end if end if next strSQL = strSQL & ") UNION " end if 'les articles/sections if Request.QueryString("chkLink") = "on" then strSQL = strSQL & "SELECT '3;4;5' AS vCount, " & _ "'Lien' & Status as vTable, " & _ "ID_Link as vID, " & _ "Nom AS v1, " & _ "Description AS v2," & _ "URL AS v3, " & _ "Parent AS v4, " & _ "'' AS v5, " & _ "'' AS v6 " & _ "FROM tbl_Link WHERE (" for I = 0 to Ubound(aWord) strSQL = strSQL & "(" & SearchQueryPlus("Nom", aWord(I)) & " OR " & SearchQueryPlus("Description", aWord(I)) & " OR " & SearchQueryPlus("URL", aWord(I)) & ")" if Ubound(aKey) >= I + 1 then if aKey(I + 1) = 0 then strSQL = strSQL & " AND " else if aKey(I) = 0 then strSQL = strSQL & ") OR (" else strSQL = strSQL & " OR " end if end if end if next strSQL = strSQL & ") UNION " end if dim arrFields(5) if strSQL <> "" then strSQL = left(strSQL, Len(strSQL) - 6) 'response.Write strSQL RSK.Open strSQL, CN if not RSK.EOF then dim vStrText, TextArr, TempArr, vCount vStrText = "" dim ResultArr(), Iarr Redim ResultArr(0) Iarr = 0 do while not RSK.EOF for I = 0 to 5 arrFields(I) = RSK.Fields("v" & I + 1) next TempArr = Split(RSK.Fields("vCount"), "|") TextArr = Split(TempArr(0), ";") vStrText = "" for I = 0 TO ubound(TextArr) vStrText = vStrText & ArrFields(cInt(TextArr(I)) - 3) & " " next vCount = CountKeywords(vStrText, ListWord) If Ubound(TempArr) = 1 then vCount = vCount + CountKeywords(TempArr(1), ListKey) end if ResultArr(Iarr) = Array(vCount, cStr(RSK(1)), cInt(RSK(2)), arrFields(0), arrFields(1), arrFields(2), arrFields(3), arrFields(4), arrFields(5)) RSK.MoveNext if not RSK.EOF then Redim Preserve ResultArr(Ubound(ResultArr) + 1) Iarr = Iarr + 1 loop dim J, temp 'on classe le array for i = UBound(ResultArr) - 1 To 0 Step -1 for j= 0 to i if ResultArr(j)(0) Ubound(ResultArr) then ShowE = Ubound(ResultArr) else ShowE = (ActPage * 20) - 1 end if %>
Résultats de la recherche
Recherchés en 0 secondes
Résultats affichés: <%=ShowB + 1%> à <%=ShowE + 1%> sur <%=Ubound(ResultArr) + 1%>.

<% BuildNavBar() For I = ShowB to ShowE select case ResultArr(I)(1) case "Section": %>

[<%=ResultArr(I)(0)%> hits] - Article internet
<%=ResultArr(I)(3)%>
<%=Trim(GetText(ResultArr(I)(4), 60))%>...
<%=BaseSite%>default.asp?s=<%=ResultArr(I)(8)%>

<% case "Article": %>

[<%=ResultArr(I)(0)%> hits] - Article de la Revue Aînés Hébergement
<%=ResultArr(I)(5)%>
Par <%=ResultArr(I)(4)%>, Volume <%=ResultArr(I)(6) \ 100%>, numéro <%=ResultArr(I)(6) mod 100%>, page <%=ResultArr(I)(7)%>
<%=basesite%>revue.asp?action=article&id=<%=ResultArr(I)(2)%>

<% case "Forum": dim vLink vLink = "forum.asp?loc=" if GetResult("SELECT Parent FROM frMess WHERE ID = (SELECT Parent FROM frMess WHERE ID = " & ResultArr(I)(2) & ")") = 0 then vLink = vLink & ResultArr(I)(2) else vLink = vLink & GetResult("SELECT Parent FROM frMess WHERE ID = " & ResultArr(I)(2)) end if vLink = vLink & "&flo=" if GetResult("SELECT Parent FROM frMess WHERE ID = " & ResultArr(I)(2)) = 0 then vLink = vLink & 0 else vLink = vLink & 2 end if %>

[<%=ResultArr(I)(0)%> hits] - Message posté sur le forum
<%=ResultArr(I)(3)%>
Posté par <% if ResultArr(I)(6) <> "" then %> <%=ResultArr(I)(5)%> <% else %> <%=ResultArr(I)(5)%> <% end if %> le <%=FormDateLisible(ResultArr(I)(8))%>.
<%=vLink%>

<% case "LienF": %>

[<%=ResultArr(I)(0)%> hits] - Lien externe répertorié
<%=ResultArr(I)(3)%>
<%=Trim(GetText(ResultArr(I)(4), 60))%>...
<%=ResultArr(I)(5)%>

<% case "LienD": %>

[<%=ResultArr(I)(0)%> hits] - Répertoire de liens externes
<%=ResultArr(I)(3)%>
<%=BaseSite%>liens.asp?p=<%=ResultArr(I)(2)%>

<% end select next BuildNavBar() %>
<% else %>Aucuns résultat
Recherchés en 0 secondes<% end if RSK.Close Response.Write "" else %>Vous devez sélectionner une ou plusieurs perspectives de recheche<% end if end if %>