% '################################################################################# '## 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 '## '################################################################################# %> <% if Request("CAT_ID") <> "" then if IsNumeric(Request("CAT_ID")) = True then Cat_ID = cLng(Request("CAT_ID")) else Cat_ID = 0 end if if Request("FORUM_ID") <> "" then if IsNumeric(Request("FORUM_ID")) = True then Forum_ID = cLng(Request("FORUM_ID")) else Forum_ID = 0 end if if Request("TOPIC_ID") <> "" then if IsNumeric(Request("TOPIC_ID")) = True then Topic_ID = cLng(Request("TOPIC_ID")) else Topic_ID = 0 end if if Request("REPLY_ID") <> "" then if IsNumeric(Request("REPLY_ID")) = True then Reply_ID = cLng(Request("REPLY_ID")) else Reply_ID = 0 end if if Request("MEMBER_ID") <> "" then if IsNumeric(Request("MEMBER_ID")) = True then Member_ID = cLng(Request("MEMBER_ID")) else Member_ID = 0 end if if (Cat_ID + Forum_ID + Topic_ID + Reply_ID + Member_ID) < 1 then Response.Write "
כתובת הרשת שונתה!
" & vbNewLine & _ "ייתכן שהיה נסיון פריצה!
" & vbNewLine WriteFooterShort Response.End end if Mode_Type = ChkString(Request("mode"), "SQLString") strPassword = trim(Request.Form("Pass")) if request("ARCHIVE") = "true" then strActivePrefix = strTablePrefix & "A_" ArchiveView = "true" ArchiveLink = "ARCHIVE=true&" else strActivePrefix = strTablePrefix ArchiveView = "" ArchiveLink = "" end if select case Mode_Type case "DeleteReply" strEncodedPassword = sha256("" & strPassword) mLev = cLng(ChkUser3(strDBNTFUserName, strEncodedPassword, Reply_ID)) if mLev > 0 then '## is Member if (chkForumModerator(Forum_ID, strDBNTFUserName) = "1") or (mLev = 1) or (mLev = 4) then '## is Allowed strSql = "SELECT R_STATUS" strSql = strSql & " FROM " & strActivePrefix & "REPLY " strSql = strSql & " WHERE REPLY_ID = " & Reply_ID set rs = my_Conn.Execute (strSql) Reply_Status = rs("R_STATUS") rs.close set rs = nothing '## Forum_SQL - Delete reply strSql = "DELETE FROM " & strActivePrefix & "REPLY " strSql = strSql & " WHERE REPLY_ID = " & Reply_ID my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords '## Forum_SQL - Get last_post and last_post_author for Topic strSql = "SELECT REPLY_ID, R_DATE, R_AUTHOR, R_STATUS" strSql = strSql & " FROM " & strActivePrefix & "REPLY " strSql = strSql & " WHERE TOPIC_ID = " & Topic_ID & " " strSql = strSql & " AND R_STATUS <= 1 " strSql = strSql & " ORDER BY R_DATE DESC" set rs = my_Conn.Execute (strSql) if not(rs.eof or rs.bof) then strLast_Post_Reply_ID = rs("REPLY_ID") strLast_Post = rs("R_DATE") strLast_Post_Author = rs("R_AUTHOR") end if if (rs.eof or rs.bof) or IsNull(strLast_Post) or IsNull(strLast_Post_Author) then 'topic has no replies set rs2 = Server.CreateObject("ADODB.Recordset") '## Forum_SQL - Get post_date and author from Topic strSql = "SELECT T_AUTHOR, T_DATE " strSql = strSql & " FROM " & strActivePrefix & "TOPICS " strSql = strSql & " WHERE TOPIC_ID = " & Topic_ID & " " set rs2 = my_Conn.Execute (strSql) strLast_Post_Reply_ID = 0 strLast_Post = rs2("T_DATE") strLast_Post_Author = rs2("T_AUTHOR") rs2.Close set rs2 = nothing end if rs.Close set rs = nothing '## FORUM_SQL - Decrease count of replies to individual topic by 1 '## Only if R_STATUS <= 1 if Reply_Status <= 1 then strSql = "UPDATE " & strActivePrefix & "TOPICS " strSql = strSql & " SET T_REPLIES = T_REPLIES - 1 " if strLast_Post <> "" then strSql = strSql & ", T_LAST_POST = '" & strLast_Post & "'" if strLast_Post_Author <> "" then strSql = strSql & ", T_LAST_POST_AUTHOR = " & strLast_Post_Author & "" end if end if strSql = strSql & ", T_LAST_POST_REPLY_ID = " & strLast_Post_Reply_ID & "" strSql = strSql & " WHERE TOPIC_ID = " & Topic_ID my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords '## Forum_SQL - Get last_post and last_post_author for Forum strSql = "SELECT TOPIC_ID, T_LAST_POST, T_LAST_POST_AUTHOR, T_LAST_POST_REPLY_ID " strSql = strSql & " FROM " & strActivePrefix & "TOPICS " strSql = strSql & " WHERE FORUM_ID = " & Forum_ID & " " strSql = strSql & " ORDER BY T_LAST_POST DESC" set rs = my_Conn.Execute (strSql) if not rs.eof then strLast_Post = rs("T_LAST_POST") strLast_Post_Author = rs("T_LAST_POST_AUTHOR") strLast_Post_Topic_ID = rs("TOPIC_ID") strLast_Post_Reply_ID = rs("T_LAST_POST_REPLY_ID") else strLast_Post = "" strLast_Post_Author = "NULL" strLast_Post_Topic_ID = 0 strLast_Post_Reply_ID = 0 end if rs.Close set rs = nothing '## Forum_SQL - Decrease count of total replies in Forum by 1 '## Only if deleted reply wasn't archived if ArchiveView = "" then strSql = "UPDATE " & strTablePrefix & "FORUM " strSql = strSql & " SET F_COUNT = F_COUNT - 1 " strSql = strSql & ", F_LAST_POST = '" & strLast_Post & "'" strSql = strSql & ", F_LAST_POST_AUTHOR = " & strLast_Post_Author strSql = strSql & ", F_LAST_POST_TOPIC_ID = " & strLast_Post_Topic_ID strSql = strSql & ", F_LAST_POST_REPLY_ID = " & strLast_Post_Reply_ID strSql = strSql & " WHERE FORUM_ID = " & Forum_ID my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords '## FORUM_SQL - Decrease count of total replies in Totals table by 1 strSql = "UPDATE " & strTablePrefix & "TOTALS " strSql = strSql & " SET P_COUNT = P_COUNT - 1 " my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords end if else strSql = "UPDATE " & strActivePrefix & "TOPICS " strSql = strSql & " SET T_UREPLIES = T_UREPLIES - 1 " strSql = strSql & " WHERE TOPIC_ID = " & Topic_ID my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords end if Response.Write "התגובה נמחקה!
" & vbNewLine & _ " " & vbNewLine else Response.Write "אין הרשאות למחיקת התגובה
" & vbNewLine & _ " " & vbNewLine end if else Response.Write "אין הרשאות למחיקת תגובות
" & vbNewLine & _ " " & vbNewLine end if case "DeleteTopic" strEncodedPassword = sha256("" & strPassword) mLev = cLng(chkUser5(strDBNTFUserName, strEncodedPassword, Topic_ID)) if mLev > 0 then '## is Member if (chkForumModerator(Forum_ID, strDBNTFUserName) = "1") or (mLev = 1) or (mLev = 4) then delAr = split(Topic_ID, ",") for i = 0 to ubound(delAr) '## Forum_SQL - count total number of replies of TOPIC_ID in Reply table set rs = Server.CreateObject("ADODB.Recordset") strSql = "SELECT count(REPLY_ID) AS cnt " strSql = strSql & " FROM " & strActivePrefix & "REPLY " strSql = strSql & " WHERE TOPIC_ID = " & cLng(delAr(i)) rs.Open strSql, my_Conn risposte = rs("cnt") rs.close set rs = nothing '## Forum_SQL - get topic status so you know if the counts need to be updated set rs = Server.CreateObject("ADODB.Recordset") strSql = "SELECT T_STATUS " strSql = strSql & " FROM " & strActivePrefix & "TOPICS " strSql = strSql & " WHERE TOPIC_ID = " & cLng(delAr(i)) rs.Open strSql, my_Conn Topic_Status = rs("T_STATUS") rs.close set rs = nothing '## Forum_SQL - Delete the actual topics strSql = "DELETE FROM " & strActivePrefix & "TOPICS " strSql = strSql & " WHERE TOPIC_ID = " & cLng(delAr(i)) my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords '## Forum_SQL - Delete all replys related to the topics strSql = "DELETE FROM " & strActivePrefix & "REPLY " strSql = strSql & " WHERE TOPIC_ID = " & cLng(delAr(i)) my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords '## Forum_SQL - Delete any subscriptions to this topic strSql = "DELETE FROM " & strTablePrefix & "SUBSCRIPTIONS " strSql = strSql & " WHERE TOPIC_ID = " & cLng(delAr(i)) my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords '## Don't update if topic was in archive if (Topic_Status <= 1) and (ArchiveView = "") then '## Forum_SQL - Get last_post and last_post_author for Forum strSql = "SELECT TOPIC_ID, T_LAST_POST, T_LAST_POST_AUTHOR, T_LAST_POST_REPLY_ID" strSql = strSql & " FROM " & strTablePrefix & "TOPICS " strSql = strSql & " WHERE FORUM_ID = " & Forum_ID & " " strSql = strSql & " ORDER BY T_LAST_POST DESC" set rs = my_Conn.Execute (strSql) if not rs.eof then rs.movefirst strLast_Post = rs("T_LAST_POST") strLast_Post_Author = rs("T_LAST_POST_AUTHOR") strLast_Post_Topic_ID = rs("TOPIC_ID") strLast_Post_Reply_ID = rs("T_LAST_POST_REPLY_ID") else strLast_Post = "" strLast_Post_Author = "NULL" strLast_Post_Topic_ID = 0 strLast_Post_Reply_ID = 0 end if rs.Close set rs = nothing '## Forum_SQL - Update count of replies to a topic in Forum table strSql = "UPDATE " & strTablePrefix & "FORUM " strSql = strSql & " SET F_COUNT = F_COUNT - " & cLng(risposte) + 1 strSql = strSql & ", F_TOPICS = F_TOPICS - " & 1 strSql = strSql & ", F_LAST_POST = '" & strLast_Post & "' " strSql = strSql & ", F_LAST_POST_AUTHOR = " & strLast_Post_Author strSql = strSql & ", F_LAST_POST_TOPIC_ID = " & strLast_Post_Topic_ID strSql = strSql & ", F_LAST_POST_REPLY_ID = " & strLast_Post_Reply_ID strSql = strSql & " WHERE FORUM_ID = " & Forum_ID my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords '## Forum_SQL - Update total TOPICS in Totals table strSql = "UPDATE " & strTablePrefix & "TOTALS " strSql = strSql & " SET T_COUNT = T_COUNT - " & 1 strSql = strSql & ", P_COUNT = P_COUNT - " & cLng(risposte) + 1 my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords end if next Response.Write "הנושא נמחק!
" & vbNewLine & _ " " & vbNewLine else Response.Write "אין הרשאות למחיקת הנושא
" & vbNewLine & _
"
חזור לאימות זהותך מחדש
אין הרשאות למחיקת הנושא
" & vbNewLine & _
"
חזור לאימות זהותך מחדש
הפורום נמחק!
" & vbNewLine & _ " " & vbNewLine else Response.Write "אין הרשאות למחיקת הפורום
" & vbNewLine & _
"
חזור לאימות זהותך מחדש
אין הרשאות למחיקת הפורום
" & vbNewLine & _
"
חזור לאימות זהותך מחדש
הקטגוריה נמחקה!
" & vbNewLine & _ " " & vbNewLine else Response.Write "אין הרשאות למחיקת הקטגוריה
" & vbNewLine & _
"
חזור לאימות זהותך מחדש
אין הרשאות למחיקת הקטגוריה
" & vbNewLine & _
"
חזור לאימות זהותך מחדש
" if intDeleted > 0 then Response.Write("החבר נמחק!") else Response.Write("לא נמחק אף חבר!") end if Response.Write "
" & vbNewLine & _ " " & vbNewLine else Response.Write "אין הרשאות למחיקת חברים
" & vbNewLine & _
"
חזור לאימות זהותך מחדש
אין הרשאות למחיקת חברים
" & vbNewLine & _
"
חזור לאימות זהותך מחדש
מחיקת " select case Mode_Type case "Member" Response.Write("חבר") case "Category" Response.Write("קטגוריה") case "Forum" Response.Write("פורום") case "Topic" Response.Write("ונשא") case "Reply" Response.Write("תגובה") end select Response.Write "
" & vbNewLine & _ "הערה: " select case Mode_Type case "Member" Response.Write("רק מנהל ראשי יכול למחוק חבר.") case "Category" Response.Write("רק מנהל ראשי יכול למחוק קטגוריה.") case "Forum" Response.Write("רק מנהל ראשי יכול למחוק פורומים.") case "Topic" Response.Write("רק מנהל ראשי, מנהל פורום או מחבר הנושא יכולים למחוק נושא (אם אף אחד לא הגיב אליו).") case "Reply" Response.Write("רק מנהל ראשי, מנהל פורום או מחבר התגובה יכולים למחוק תגובה.") end select Response.Write "
" & vbNewLine & _ " " & vbNewLine end select WriteFooterShort Response.End function chkUser5(fName, fPassword, fTopic) '## Forum_SQL strSql = "SELECT M.MEMBER_ID, M.M_LEVEL, M.M_NAME, M.M_PASSWORD, T.T_AUTHOR, T.T_REPLIES " strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS M, " & strActivePrefix & "TOPICS T " StrSql = strSql & " WHERE M." & strDBNTSQLName & " = '" & fName & "' " if strAuthType="db" then strSql = strSql & " AND M.M_PASSWORD = '" & fPassword &"' " End If strSql = strSql & " AND T.TOPIC_ID = " & fTopic strSql = strSql & " AND M.M_STATUS = " & 1 set rsCheck = my_Conn.Execute (strSql) if rsCheck.BOF or rsCheck.EOF or not(ChkQuoteOk(fName)) or not(ChkQuoteOk(fPassword)) then chkUser5 = 0 '## Invalid Password else if cLng(rsCheck("MEMBER_ID")) = cLng(rsCheck("T_AUTHOR")) and cLng(rsCheck("T_REPLIES")) < 1 then chkUser5 = 1 '## Author else Select case cLng(rsCheck("M_LEVEL")) case 1 chkUser5 = 2 '## Normal User case 2 chkUser5 = 3 '## Moderator case 3 chkUser5 = 4 '## Admin case else chkUser5 = cLng(rsCheck("M_LEVEL")) End Select end if end if rsCheck.close set rsCheck = nothing end function function chkUser3(fName, fPassword, fReply) '## Forum_SQL strSql = "SELECT M.MEMBER_ID, M.M_LEVEL, M.M_NAME, M.M_PASSWORD, R.R_AUTHOR " strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS M, " & strActivePrefix & "REPLY R " StrSql = strSql & " WHERE M." & strDBNTSQLName & " = '" & fName & "' " if strAuthType="db" then strSql = strSql & " AND M.M_PASSWORD = '" & fPassword &"' " End If strSql = strSql & " AND R.REPLY_ID = " & fReply strSql = strSql & " AND M.M_STATUS = " & 1 set rsCheck = my_Conn.Execute (strSql) if rsCheck.BOF or rsCheck.EOF or not(ChkQuoteOk(fName)) or not(ChkQuoteOk(fPassword)) then chkUser3 = 0 '## Invalid Password else if cLng(rsCheck("MEMBER_ID")) = cLng(rsCheck("R_AUTHOR")) then chkUser3 = 1 '## Author else Select case cLng(rsCheck("M_LEVEL")) case 1 chkUser3 = 2 '## Normal User case 2 chkUser3 = 3 '## Moderator case 3 chkUser3 = 4 '## Admin case else chkUser3 = cLng(rsCheck("M_LEVEL")) End Select end if end if rsCheck.close set rsCheck = nothing end function function chkCanDelete(fAM_ID, fM_ID) '## Forum_SQL strSql = "SELECT MEMBER_ID, M_LEVEL " strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS " StrSql = strSql & " WHERE MEMBER_ID = " & fM_ID set rsCheck = my_Conn.Execute (strSql) if rsCheck.BOF or rsCheck.EOF then chkCanDelete = 0 '## No Members Found else if cLng(rsCheck("MEMBER_ID")) = cLng(fAM_ID) then chkCanDelete = 0 '## Can't delete self else Select case cLng(rsCheck("M_LEVEL")) case 1 chkCanDelete = 1 '## Can delete Normal User case 2 chkCanDelete = 1 '## Can delete Moderator case 3 if fAM_ID <> intAdminMemberID then chkCanDelete = 0 '## Only the Forum Admin can delete other Administrators else chkCanDelete = 1 '## Forum Admin is ok to delete other Administrators end if case else chkCanDelete = 0 '## Member doesn't have a Member Level? End Select end if end if rsCheck.close set rsCheck = nothing end function %>