<% set my_conn= Server.CreateObject("ADODB.Connection") set rs = Server.CreateObject("ADODB.Recordset") my_Conn.Open ConnString Function FormatStr(String) on Error resume next String = Replace(String, CHR(13), "") String = Replace(String, CHR(10) & CHR(10), "

") String = Replace(String, CHR(10), "
") FormatStr = String End Function If Request.QueryString("mode") = "doit" then if Request.Form("search") <> "" then ' Build Nightmare SQL Statement - Kill Server!!! keywords = split(Request.Form("search"), " ") keycnt = ubound(keywords) StrSql ="SELECT Forum.*, Reply.*, Topics.* FROM (Forum LEFT JOIN Topics " StrSql = StrSQl & "ON Forum.Forum_ID = Topics.Forum_id) LEFT JOIN Reply ON Topics.Topic_ID = Reply.Topic_ID " StrSQl = StrSql & "WHERE " if Request.Form("forum") <> 0 then StrSql = StrSql & "Forum.Forum_ID = " & Request.Form("forum") & " and " End If StrSQL = StrSql & "(" if Request.Form("searchdate") <> 0 then dt = cint(Request.Form("searchdate")) StrSql = StrSql & "T_date > #" & dateadd("d", -dt, now) & "#) and (" End if cnt = 0 For Each word in keywords StrSql =StrSql & "Forum.F_Description Like '%" & word & "%' or Reply.R_Message Like '%" StrSql =StrSql & word & "%' or Topics.T_Message Like '%" StrSql =StrSql & word & "%' " if cnt < keycnt then StrSql = StrSql & Request.Form("andor") cnt = cnt + 1 next StrSql =StrSql & ") order by topics.topic_id" mypage=request("whichpage") If mypage="" then mypage=1 end if rs.Open StrSql, my_Conn, 3,1 If rs.Eof or rs.Bof then ' No categories found in DB Response.Write "Não foram encontrados resultados" Else %> <% rec_id="" do until rs.Eof '## Display Forum if rec_id = rs("topic_id") then ' Don't do anything Else Response.Write "" Response.Write "" Response.Write "" Response.Write "" End if rec_id = rs("topic_id") rs.MoveNext loop %>
Tema Data Fórum
" Response.Write "" & rs("T_Subject") & "" & rs("T_date") & "" & rs("F_Name") & "

Voltar ao Fórum <% End If Else ' Search = "" %>

Tem de introduzir as palavras a pesquisar

Voltar ao Fórum <% Response.End End if ' Search = "" Else %>


Procurar por :
Procura por todas as palavras
Procura por qualquer das palavras
Procurar Fórum :
Procurar por data :
<% End If on error resume next set rs = nothing my_conn.Close set my_conn = nothing %>