%
'#################################################################################
'## Copyright (C) 2000 Michael Anderson and Pierre Gorissen
'##
'## This program is free software; you can redistribute it and/or
'## modify it under the terms of the GNU General Public License
'## as published by the Free Software Foundation; either version 2
'## of the License, or any later version.
'##
'## All copyright notices regarding Snitz Forums 2000
'## must remain intact in the scripts and in the outputted HTML
'## The "powered by" text/logo with a link back to
'## http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful,
'## but WITHOUT ANY WARRANTY; without even the implied warranty of
'## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'## GNU General Public License for more details.
'##
'## You should have received a copy of the GNU General Public License
'## along with this program; if not, write to the Free Software
'## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
'##
'## Support can be obtained from support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and Marketing Questions can be sent to:
'## reinhold@bigfoot.com
'##
'## or
'##
'## Snitz Communications
'## C/O: Michael Anderson
'## PO Box 200
'## Harpswell, ME 04079
'#################################################################################
%>
<% set rs = Server.CreateObject("ADODB.Recordset") %>
All Forums
<% If Request.QueryString("mode") = "DoIt" then %>
 ">Search Form
  Search Results: <%=Request.Form("Search")%>
<% else %>
 Search Form
<% end if %>
|
<%
If Request.QueryString("mode") = "DoIt" then
if Request.Form("Search") <> "" then
keywords = split(Request.Form("Search"), " ")
keycnt = ubound(keywords)
'## Forum_SQL - Find all records with the search criteria in them
strSql = "SELECT " & strTablePrefix & "FORUM.FORUM_ID, " & strTablePrefix & "FORUM.F_SUBJECT, " & strTablePrefix & "FORUM.CAT_ID, " & strTablePrefix & "TOPICS.TOPIC_ID, " & strTablePrefix & "TOPICS.T_SUBJECT, " & strTablePrefix & "TOPICS.T_MAIL, " & strTablePrefix & "TOPICS.T_STATUS, " & strTablePrefix & "TOPICS.T_LAST_POST, " & strTablePrefix & "TOPICS.T_REPLIES, " & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " & strMemberTablePrefix & "MEMBERS.M_NAME "
strSql = strSql & " FROM ((" & strTablePrefix & "FORUM LEFT JOIN " & strTablePrefix & "TOPICS "
strSql = strSql & " ON " & strTablePrefix & "FORUM.FORUM_ID = " & strTablePrefix & "TOPICS.FORUM_ID) LEFT JOIN " & strTablePrefix & "REPLY "
strSql = strSql & " ON " & strTablePrefix & "TOPICS.TOPIC_ID = " & strTablePrefix & "REPLY.TOPIC_ID) LEFT JOIN " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " ON " & strTablePrefix & "TOPICS.T_AUTHOR = " & strMemberTablePrefix & "MEMBERS.MEMBER_ID "
strSql = strSql & " WHERE ("
'################# New Search Code #################################################
if Request.Form("SearchMessage") = 1 then
if Request.Form("andor") = "phrase" then
strSql = strSql & " (" & strTablePrefix & "FORUM.F_SUBJECT LIKE '%" & ChkString(Request.Form("Search"), "SQLString") & "%'"
strSql = strSql & " OR " & strTablePrefix & "TOPICS.T_SUBJECT LIKE '%" & ChkString(Request.Form("Search"), "SQLString") & "%') "
else
For Each word in keywords
SearchWord = ChkString(word, "SQLString")
strSql = strSql & " (" & strTablePrefix & "FORUM.F_SUBJECT LIKE '%" & SearchWord & "%'"
strSql = strSql & " OR " & strTablePrefix & "TOPICS.T_SUBJECT LIKE '%" & SearchWord & "%') "
if cnt < keycnt then strSql = strSql & Request.Form("andor")
cnt = cnt + 1
next
end if
else
if Request.Form("andor") = "phrase" then
strSql = strSql & " (" & strTablePrefix & "REPLY.R_MESSAGE LIKE '%" & ChkString(Request.Form("Search"), "SQLString") & "%'"
strSql = strSql & " OR " & strTablePrefix & "FORUM.F_DESCRIPTION LIKE '%" & ChkString(Request.Form("Search"), "SQLString") & "%'"
strSql = strSql & " OR " & strTablePrefix & "TOPICS.T_SUBJECT LIKE '%" & ChkString(Request.Form("Search"), "SQLString") & "%'"
strSql = strSql & " OR " & strTablePrefix & "TOPICS.T_MESSAGE LIKE '%" & ChkString(Request.Form("Search"), "SQLString") & "%') "
else
For Each word in keywords
SearchWord = ChkString(word, "SQLString")
strSql = strSql & " (" & strTablePrefix & "REPLY.R_MESSAGE LIKE '%" & SearchWord & "%'"
strSql = strSql & " OR " & strTablePrefix & "FORUM.F_DESCRIPTION LIKE '%" & SearchWord & "%'"
strSql = strSql & " OR " & strTablePrefix & "TOPICS.T_SUBJECT LIKE '%" & SearchWord & "%'"
strSql = strSql & " OR " & strTablePrefix & "TOPICS.T_MESSAGE LIKE '%" & SearchWord & "%') "
if cnt < keycnt then strSql = strSql & Request.Form("andor")
cnt = cnt + 1
next
end if
'################# New Search Code #################################################
end if
strSql = strSql & " ) "
cnt = 0
if Request.Form("Forum") <> 0 then
strSql = strSql & " AND " & strTablePrefix & "FORUM.FORUM_ID = " & Request.Form("Forum") & " "
end if
if Request.Form("SearchDate") <> 0 then
dt = cint(Request.Form("SearchDate"))
strSql = strSql & " AND (T_DATE > '" & DateToStr(dateadd("d", -dt, strForumTimeAdjust)) & "')"
end if
if Request.Form("SearchMember") <> 0 then
strSql = strSql & " AND (" & strMemberTablePrefix & "MEMBERS.MEMBER_ID = " & Request.Form("SearchMember") & " "
strSql = strSql & " OR " & strTablePrefix & "REPLY.R_AUTHOR = " & Request.Form("SearchMember") & ") "
end if
strSql = strSql & " AND " & strTablePrefix & "FORUM.F_TYPE = " & 0
strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.FORUM_ID DESC, "
strSql = strSql & " " & strTablePrefix & "TOPICS.T_LAST_POST DESC"
mypage = request("whichpage")
If mypage = "" then
mypage = 1
end if
rs.Open strSql, my_Conn, 3,1
%>
| |
Topic |
Author |
Replies |
Last Post |
<% if rs.EOF or rs.BOF then '## No topic %>
| No Matches Found |
<%
else
rs.MoveFirst
currForum = 0
currTopic = 0
do until rs.EOF
if ChkForumAccess(rs("FORUM_ID")) then
'## Forum_SQL - Find out if the Category is Locked or Un-Locked and if it Exists
strSql = "SELECT " & strTablePrefix & "CATEGORY.CAT_STATUS "
strSql = strSql & ", " & strTablePrefix & "FORUM.F_STATUS "
strSql = strSql & " FROM " & strTablePrefix & "CATEGORY "
strSql = strSql & " , " & strTablePrefix & "FORUM "
strSql = strSql & " WHERE " & strTablePrefix & "CATEGORY.CAT_ID = " & strTablePrefix & "FORUM.CAT_ID "
strSql = strSql & " AND " & strTablePrefix & "FORUM.FORUM_ID = " & rs("FORUM_ID")
set rsCFStatus = my_Conn.Execute (StrSql)
if (currForum <> rs("FORUM_ID")) and (currTopic <> rs("TOPIC_ID")) then
%>
| <% =ChkString(rs("F_SUBJECT"),"display") %> |
<% currForum = rs("FORUM_ID")
end if %>
<% if currTopic <> rs("TOPIC_ID") then %>
<% if rsCFStatus("CAT_STATUS") <> 0 and rsCFstatus("F_STATUS") <> 0 and rs("T_STATUS") <> 0 then %>
| &FORUM_ID=<% =rs("FORUM_ID") %>&CAT_ID=<% =rs("CAT_ID") %>&Topic_Title=<% =ChkString(left(rs("T_SUBJECT"), 50),"urlpath") %>&Forum_Title=<% =ChkString(rs("F_SUBJECT"),"urlpath") %>"><% =ChkIsNew(rs("T_LAST_POST")) %> |
<% else %>
&FORUM_ID=<% =rs("FORUM_ID") %>&CAT_ID=<%=rs("CAT_ID") %>&Topic_Title=<% =ChkString(left(rs("T_SUBJECT"), 50),"urlpath") %>&Forum_Title=<%=ChkString(rs("F_SUBJECT"),"urlpath") %>">
border="0">
|
<% end if %>
&FORUM_ID=<% =rs("FORUM_ID") %>&CAT_ID=<% =rs("CAT_ID") %>&Topic_Title=<% =ChkString(left(rs("T_SUBJECT"), 50),"urlpath") %>&Forum_Title=<% =ChkString(rs("F_SUBJECT"),"urlpath") %>"><% =ChkString(left(rs("T_SUBJECT"), 50),"display") %> |
<% =ChkString(rs("M_NAME"),"display") %> |
<% =rs("T_REPLIES") %> |
<% =ChkDate(rs("T_LAST_POST")) %> <% =ChkTime(rs("T_LAST_POST")) %> |
<% currTopic = rs("TOPIC_ID")
end if
end if
rs.MoveNext
loop
end if
%>
|
>
Back To Search Page
<% Else %>
You must enter keywords
Back To Search Page
<%
end if
Else
%>
<% end if %>
<% on error resume next %>
<% set rs = nothing %>