⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 search.asp

📁 代码名称: Snitz Forums 2000 代码语言: 英文 代码类型: 国外代码 运行环境: ASP 授权方式: 免费代码 代码大小: 530kb 代码等级: 3 整
💻 ASP
📖 第 1 页 / 共 3 页
字号:
<%
'#################################################################################
'## Snitz Forums 2000 v3.4.05
'#################################################################################
'## Copyright (C) 2000-05 Michael Anderson, Pierre Gorissen,
'##                       Huw Reddick and Richard Kinser
'##
'## 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 (at your option) 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 our support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and Marketing Questions can be sent to:
'## manderson@snitz.com
'##
'#################################################################################
%>
<!--#INCLUDE FILE="config.asp"-->
<%
Dim HasHigherSub
Dim HeldFound, UnApprovedFound, UnModeratedPosts, UnModeratedFPosts
Dim canView
HasHigherSub = false
Dim strUseMemberDropDownBox
strUseMemberDropDownBox = 1
%>
<!--#INCLUDE FILE="inc_sha256.asp"-->
<!--#INCLUDE FILE="inc_header.asp" -->
<!--#INCLUDE FILE="inc_func_secure.asp" -->
<!--#INCLUDE FILE="inc_func_chknew.asp" -->
<!--#INCLUDE FILE="inc_moderation.asp" -->
<!--#INCLUDE FILE="inc_subscription.asp" -->
<% 
Dim ArchiveView
Dim AdminAllowed, ModerateAllowed
Dim SearchLink : SearchLink = ""
if request("ARCHIVE") = "true" then
	strActivePrefix = strArchiveTablePrefix
	ArchiveView = "true"
	ArchiveLink = "ARCHIVE=true&"
else
	strActivePrefix = strTablePrefix
	ArchiveView = ""
	ArchiveLink = ""
end if

select case cLng(Request.Form("andor"))
	case 1 : strAndOr = " and "
	case 2 : strAndOr = " or "
	case 3 : strAndOr = "phrase"
	case else : strAndOr = " and "
end select

Response.Write	"    <script language=""JavaScript"" type=""text/javascript"">" & vbNewLine & _
		"    function ChangePage(fnum){" & vbNewLine & _
		"    	if (fnum == 1) {" & vbNewLine & _
		"    		document.PageNum1.submit();" & vbNewLine & _
		"    		}" & vbNewLine & _
		"    	else {" & vbNewLine & _
		"    		document.PageNum2.submit();" & vbNewLine & _
		"    	}" & vbNewLine & _
		"    }" & vbNewLine & _
		"    </script>" & vbNewLine

' -- Get all the high level(board, category, forum) subscriptions being held by the user
Dim strSubString, strSubArray, strBoardSubs, strCatSubs, strForumSubs, strTopicSubs
if MySubCount > 0 then
	strSubString = PullSubscriptions(0,0,0)
	strSubArray  = Split(strSubString,";")
	if uBound(strSubArray) < 0 then
		strBoardSubs = ""
		strCatSubs = ""
		strForumSubs = ""
		strTopicSubs = ""
	else
		strBoardSubs = strSubArray(0)
		strCatSubs = strSubArray(1)
		strForumSubs = strSubArray(2)
		strTopicSubs = strSubArray(3)
	end if
end if

' DEM --> Added code for topic moderation
if mlev = 3 then
	strSql = "SELECT FORUM_ID FROM " & strTablePrefix & "MODERATOR " & _
		 " WHERE MEMBER_ID = " & MemberID

	Set rsMod = Server.CreateObject("ADODB.Recordset")
	rsMod.open strSql, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText

	if rsMod.EOF then
		recModCount = ""
	else
		allModData = rsMod.GetRows(adGetRowsRest)
		recModCount = UBound(allModData,2)
	end if

	RsMod.close
	set RsMod = nothing

	if recModCount <> "" then
		for x = 0 to recModCount
			if x = 0 then
				ModOfForums = allModData(0,x)
			else
				ModOfForums = ModOfForums & "," & allModData(0,x)
			end if
		next
	else
		ModOfForums = ""
	end if
else
	ModOfForums = ""
end if

if strPrivateForums = "1" and mLev < 4 then
	allAllowedForums = ""

	allowSql = "SELECT FORUM_ID, F_SUBJECT, F_PRIVATEFORUMS, F_PASSWORD_NEW"
	allowSql = allowSql & " FROM " & strTablePrefix & "FORUM"
	allowSql = allowSql & " WHERE F_TYPE = 0"
	allowSql = allowSql & " ORDER BY FORUM_ID"

	set rsAllowed = Server.CreateObject("ADODB.Recordset")
	rsAllowed.open allowSql, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText

	if rsAllowed.EOF then
		recAllowedCount = ""
	else
		allAllowedData = rsAllowed.GetRows(adGetRowsRest)
		recAllowedCount = UBound(allAllowedData,2)
	end if

	rsAllowed.close
	set rsAllowed = nothing

	if recAllowedCount <> "" then
		fFORUM_ID = 0
		fF_SUBJECT = 1
		fF_PRIVATEFORUMS = 2
		fF_PASSWORD_NEW = 3

		for RowCount = 0 to recAllowedCount

			Forum_ID = allAllowedData(fFORUM_ID,RowCount)
			Forum_Subject = allAllowedData(fF_SUBJECT,RowCount)
			Forum_PrivateForums = allAllowedData(fF_PRIVATEFORUMS,RowCount)
			Forum_FPasswordNew = allAllowedData(fF_PASSWORD_NEW,RowCount)

			if mLev = 4 then
				ModerateAllowed = "Y"
			elseif mLev = 3 and ModOfForums <> "" then
				if (strAuthType = "nt") then
					if (chkForumModerator(Forum_ID, Session(strCookieURL & "username")) = "1") then ModerateAllowed = "Y" else ModerateAllowed = "N"
				else 
					if (instr("," & ModOfForums & "," ,"," & Forum_ID & ",") > 0) then ModerateAllowed = "Y" else ModerateAllowed = "N"
				end if
			else
				ModerateAllowed = "N"
			end if
			if chkForumAccessNew(Forum_PrivateForums,Forum_FPasswordNew,Forum_Subject,Forum_ID,MemberID) = true then
				if allAllowedForums = "" then
					allAllowedForums = Forum_ID
				else
					allAllowedForums = allAllowedForums & "," & Forum_ID
				end if
			end if
		next
	end if
	if allAllowedForums = "" then allAllowedForums = 0
end if

if Request.QueryString("mode") = "DoIt" then
	if trim(Request.Form("Search")) <> "" or Request.QueryString("MEMBER_ID") <> "" then
		if Request.Form("Search") <> "" then
			keywords = split(Request.Form("Search"), " ")
			keycnt = ubound(keywords)
			for i = 0 to keycnt
				if i = 0 then
					strKeywords = keywords(i)
				else
					strKeywords = strKeywords & "," & keywords(i)
				end if
			next
			if strAndOr = "phrase" then strKeyWords = replace(strKeyWords,",","+")
			SearchLink = "&SearchTerms=" & chkString(strKeyWords,"search")
		end if

		'## Forum_SQL - Find all records with the search criteria in them
		strSql = "SELECT DISTINCT C.CAT_STATUS, C.CAT_SUBSCRIPTION, C.CAT_NAME, C.CAT_ORDER"
		strSql = strSql & ", F.F_ORDER, F.FORUM_ID, F.F_SUBJECT, F.CAT_ID"
		strSql = strSql & ", F.F_SUBSCRIPTION, F.F_STATUS"
		strSql = strSql & ", T.TOPIC_ID, T.T_AUTHOR, T.T_SUBJECT, T.T_STATUS, T.T_LAST_POST"
		strSql = strSql & ", T.T_LAST_POST_AUTHOR, T.T_LAST_POST_REPLY_ID, T.T_REPLIES, T.T_UREPLIES, T.T_VIEW_COUNT"
		strSql = strSql & ", M.MEMBER_ID, M.M_NAME, MEMBERS_1.M_NAME AS LAST_POST_AUTHOR_NAME"
		strSql = strSql & ", F.F_PRIVATEFORUMS, F.F_PASSWORD_NEW"

		strSql2 = " FROM ((((" & strTablePrefix & "FORUM F LEFT JOIN " & strActivePrefix & "TOPICS T"
		strSql2 = strSql2 & " ON F.FORUM_ID = T.FORUM_ID) LEFT JOIN " & strActivePrefix & "REPLY R"
		strSql2 = strSql2 & " ON T.TOPIC_ID = R.TOPIC_ID) LEFT JOIN " & strMemberTablePrefix & "MEMBERS M"
		strSql2 = strSql2 & " ON T.T_AUTHOR = M.MEMBER_ID) LEFT JOIN " & strTablePrefix & "CATEGORY C"
		strSql2 = strSql2 & " ON T.CAT_ID = C.CAT_ID) LEFT JOIN " & strMemberTablePrefix & "MEMBERS MEMBERS_1"
		strSql2 = strSql2 & " ON T.T_LAST_POST_AUTHOR = MEMBERS_1.MEMBER_ID"
		if Request.Form("Search") <> "" then
			strSql3 = " WHERE ("
			'################# New Search Code #################################################
			if Request.Form("SearchMessage") = 1 then
				if strAndOr = "phrase" then
					strSql3 = strSql3 & " (T.T_SUBJECT LIKE '%" & ChkString(Request.Form("Search"), "SQLString") & "%') "
				else
					For Each word in keywords
						SearchWord = ChkString(word, "SQLString")
						strSql3 = strSql3 & " (T.T_SUBJECT LIKE '%" & SearchWord & "%') "
						if cnt < keycnt then strSql3 = strSql3 & strAndOr
						cnt = cnt + 1
					next
				end if
			else
				if strAndOr = "phrase" then
					strSql3 = strSql3 & " (R.R_MESSAGE LIKE '%" & ChkString(Request.Form("Search"), "SQLString") & "%'"
					strSql3 = strSql3 & " OR T.T_SUBJECT LIKE '%" & ChkString(Request.Form("Search"), "SQLString") & "%'"
					strSql3 = strSql3 & " OR T.T_MESSAGE LIKE '%" & ChkString(Request.Form("Search"), "SQLString") & "%') "
				else
					For Each word in keywords
						SearchWord = ChkString(word, "SQLString")
						strSql3 = strSql3 & " (R.R_MESSAGE LIKE '%" & SearchWord & "%'"
						strSql3 = strSql3 & " OR T.T_SUBJECT LIKE '%" & SearchWord & "%'"
						strSql3 = strSql3 & " OR T.T_MESSAGE LIKE '%" & SearchWord & "%') "
						if cnt < keycnt then strSql3 = strSql3 & strAndOr
						cnt = cnt + 1
					next
				end if
			'################# New Search Code #################################################
			end if
			strSql3 = strSql3 & " ) "
		else
			strSql3 = " WHERE (0 = 0)"
		end if
		' DEM --> Added code to ignore unmoderated/held posts...
		if mlev <> 4 then 
			strSql3 = strSql3 & " AND ((T.T_AUTHOR <> " & MemberID
			strSql3 = strSql3 & " AND T.T_STATUS < 2)"  ' Ignore unapproved/held posts
			strSql3 = strSql3 & " OR T.T_AUTHOR = " & MemberID & ")"
		end if
		' DEM --> End of Code added to ignore unmoderated/held posts....
		cnt = 0
		if cLng(Request.Form("Forum")) <> 0 then
			strSql3 = strSql3 & " AND F.FORUM_ID = " & cLng(Request.Form("Forum")) & " "
		end if
		if cLng(Request.Form("SearchDate")) <> 0 then
			dt = cLng(Request.Form("SearchDate"))
			strSql3 = strSql3 & " AND ( (T.T_DATE > '" & DateToStr(dateadd("d", -dt, strForumTimeAdjust)) & "') " 
			strSql3 = strSql3 & "OR (R.R_DATE > '" & DateToStr(dateadd("d", -dt, strForumTimeAdjust)) & "') ) "
		end if
		if strUseMemberDropDownBox = 0 then
			intSearchMember = getMemberID(chkString(Request.Form("SearchMember"),"SQLString"))
			if intSearchMember <> 0 then
				strSql3 = strSql3 & " AND (M.MEMBER_ID = " & cLng(intSearchMember) & " "

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -