% 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
%>
| Tema | Data | Fórum | " Response.Write "" & rs("T_Subject") & " | " Response.Write "" & rs("T_date") & " | " Response.Write "" & rs("F_Name") & " | " Response.Write "" End if rec_id = rs("topic_id") rs.MoveNext loop %>
Voltar ao Fórum <% End If Else ' Search = "" %>
Voltar ao Fórum <% Response.End End if ' Search = "" Else %>