% '################################################################################# '## Copyright (C) 2000-01 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 '################################################################################# %> <% Cat_ID = Chkstring(Request("CAT_ID"), "SQLString") Forum_ID = ChkString(Request("FORUM_ID"), "SQLString") Topic_ID = ChkString(Request("TOPIC_ID"), "SQLString") Reply_ID = ChkString(Request("REPLY_ID"), "SQLString") Mode_Type = Request("mode") Member_ID = Request("MEMBER_ID") if strAuthType = "db" then strDBNTUserName = Request.Form("User") end if if Mode_Type = "DeleteReply" then mLev = cint(ChkUser3(strDBNTUserName, Request.Form("Pass"), Reply_ID)) if mLev > 0 then '## is Member if (chkForumModerator(Forum_ID, strDBNTUserName) = "1") or (mLev = 1) or (mLev = 4) then '## is Allowed strSql = "SELECT R_STATUS" strSql = strSql & " FROM " & strTablePrefix & "REPLY " strSql = strSql & " WHERE TOPIC_ID = " & Topic_ID & " " set rs = my_Conn.Execute (strSql) Reply_Status = rs("R_STATUS") rs.close set rs = nothing '## Forum_SQL - Delete reply strSql = "DELETE FROM " & strTablePrefix & "REPLY " strSql = strSql & " WHERE " & strTablePrefix & "REPLY.REPLY_ID = " & Reply_ID my_Conn.Execute strSql set rs = Server.CreateObject("ADODB.Recordset") '## Forum_SQL - Get last_post and last_post_author for Topic strSql = "SELECT R_DATE, R_AUTHOR, R_STATUS" strSql = strSql & " FROM " & strTablePrefix & "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 = 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 " & strTablePrefix & "TOPICS " strSql = strSql & " WHERE TOPIC_ID = " & Topic_ID & " " set rs2 = my_Conn.Execute (strSql) 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 is R_STATUS <= 1 if Reply_Status <= 1 then strSql = "UPDATE " & strTablePrefix & "TOPICS " strSql = strSql & " SET " & strTablePrefix & "TOPICS.T_REPLIES = " & strTablePrefix & "TOPICS.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 & " WHERE " & strTablePrefix & "TOPICS.TOPIC_ID = " & Topic_ID my_Conn.Execute strSql '## Forum_SQL - Get last_post and last_post_author for Forum strSql = "SELECT T_LAST_POST, T_LAST_POST_AUTHOR " 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 strLast_Post = rs("T_LAST_POST") strLast_Post_Author = rs("T_LAST_POST_AUTHOR") else strLast_Post = "" strLast_Post_Author = "" end if rs.Close set rs = nothing '## Forum_SQL - Decrease count of total replies in Forum by 1 strSql = "UPDATE " & strTablePrefix & "FORUM " strSql = strSql & " SET " & strTablePrefix & "FORUM.F_COUNT = " & strTablePrefix & "FORUM.F_COUNT - " & 1 & " " if strLast_Post <> "" then strSql = strSql & ", F_LAST_POST = '" & strLast_Post & "'" if strLast_Post_Author <> "" then strSql = strSql & ", F_LAST_POST_AUTHOR = " & strLast_Post_Author end if end if strSql = strSql & " WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & Forum_ID my_Conn.Execute strSql '## FORUM_SQL - Decrease count of total replies in Totals table by 1 strSql = "UPDATE " & strTablePrefix & "TOTALS " strSql = strSql & " SET " & strTablePrefix & "TOTALS.P_COUNT = " & strTablePrefix & "TOTALS.P_COUNT - " & 1 & " " my_Conn.Execute strSql end if %>
Reply Deleted!
(Remember to Refresh your browser.)
<% Else %>No Permissions to Delete Reply
<% end if %> <% Else %>No Permissions to Delete Reply
<% end if else if Mode_Type = "DeleteTopic" then mLev = cint(chkUser(STRdbntUserName, Request.Form("Pass"))) if mLev > 0 then '## is Member if (chkForumModerator(Forum_ID, STRdbntUserName) = "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(" & strTablePrefix & "REPLY.REPLY_ID) AS cnt " strSql = strSql & " FROM " & strTablePrefix & "REPLY " strSql = strSql & " WHERE " & strTablePrefix & "REPLY.TOPIC_ID = " & cint(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 " & strTablePrefix & "TOPICS.T_STATUS " strSql = strSql & " FROM " & strTablePrefix & "TOPICS " strSql = strSql & " WHERE " & strTablePrefix & "TOPICS.TOPIC_ID = " & cint(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 " & strTablePrefix & "TOPICS " strSql = strSql & " WHERE " & strTablePrefix & "TOPICS.TOPIC_ID = " & cint(delAr(i)) my_Conn.Execute strSql '## Forum_SQL - Delete all replys related to the topics strSql = "DELETE FROM " & strTablePrefix & "REPLY " strSql = strSql & " WHERE " & strTablePrefix & "REPLY.TOPIC_ID = " & cint(delAr(i)) my_Conn.Execute strSql if Topic_Status <= 1 then '## Forum_SQL - Get last_post and last_post_author for Forum strSql = "SELECT T_LAST_POST, T_LAST_POST_AUTHOR" 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") else strLast_Post = "" strLast_Post_Author = "" 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 " & strTablePrefix & "FORUM.F_COUNT = " & strTablePrefix & "FORUM.F_COUNT - " & cint(risposte) + 1 strSql = strSql & " , " & strTablePrefix & "FORUM.F_TOPICS = " & strTablePrefix & "FORUM.F_TOPICS - " & 1 if strLast_Post <> "" then strSql = strSql & ", F_LAST_POST = '" & strLast_Post & "' " if strLast_Post_Author <> "" then strSql = strSql & ", F_LAST_POST_AUTHOR = " & strLast_Post_Author end if end if strSql = strSql & " WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & Forum_ID my_Conn.Execute strSql '## Forum_SQL - Update total TOPICS in Totals table strSql = "UPDATE " & strTablePrefix & "TOTALS " strSql = strSql & " SET " & strTablePrefix & "TOTALS.T_COUNT = " & strTablePrefix & "TOTALS.T_COUNT - " & 1 strSql = strSql & ", " & strTablePrefix & "TOTALS.P_COUNT = " & strTablePrefix & "TOTALS.P_COUNT - " & cint(risposte) + 1 my_Conn.Execute strSql end if next %>Topic Deleted!
<% Else %>No Permissions to Delete Topic
Go Back to Re-Authenticate
No Permissions to Delete Topic
Go Back to Re-Authenticate
Forum Deleted!
<% Else %>No Permissions to Delete Forum
Go Back to Re-Authenticate
No Permissions to Delete Forum
Go Back to Re-Authenticate
Category Deleted!
<% else %>No Permissions to Delete Category
Go Back to Re-Authenticate
No Permissions to Delete Category
Go Back to Re-Authenticate
Member Deleted!
<% else %>No Permissions to Delete a Member
Go Back to Re-Authenticate
No Permissions to Delete a Member
Go Back to Re-Authenticate
Delete <% if Mode_Type = "Member" then %> Member <% else %> <% if Mode_Type = "Category" then %> Category <% else %> <% if Mode_Type = "Forum" then %> Forum <% else %> <% if Mode_Type = "Topic" then %> Topic <% else %> <% if Mode_Type = "Reply" then %> Reply <% end if %> <% end if %> <% end if %> <% end if %> <% end if %>
NOTE: <% if Mode_Type = "Member" then %> Only Administrators can delete a Member. <% else %> <% if Mode_Type = "Category" then %> Only Administrators can delete a Category. <% else %> <% if Mode_Type = "Forum" then %> Only Administrators can delete Forums. <% else %> <% if Mode_Type = "Topic" then %> Only Moderators and Administrators can delete Topics. <% else %> <% if Mode_Type = "Reply" then %> Only the Author, Moderators and Administrators can delete Replies. <% end if %> <% end if %> <% end if %> <% end if %> <% end if %>
<% end if end if end if end if end if function chkUser3(fName, fPassword, fReply) '## Forum_SQL strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " & strMemberTablePrefix & "MEMBERS.M_LEVEL, " & strMemberTablePrefix & "MEMBERS.M_NAME, " & strMemberTablePrefix & "MEMBERS.M_PASSWORD, " & strTablePrefix & "REPLY.R_AUTHOR " strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS, " & strTablePrefix & "REPLY " StrSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS." & strDBNTSQLName & " = '" & ChkString(fName, "SQLString") & "' " if strAuthType="db" then strSql = strSql & " AND " & strMemberTablePrefix & "MEMBERS.M_PASSWORD = '" & ChkString(fPassword, "SQLString") &"' " End If strSql = strSql & " AND " & strTablePrefix & "REPLY.REPLY_ID = " & ChkString(fReply, "SQLString") strSql = strSql & " AND " & strMemberTablePrefix & "MEMBERS.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 cint(rsCheck("MEMBER_ID")) = cint(rsCheck("R_AUTHOR")) then chkUser3 = 1 '## Author else Select case cint(rsCheck("M_LEVEL")) case 1 chkUser3 = 2 '## Normal User case 2 chkUser3 = 3 '## Moderator case 3 chkUser3 = 4 '## Admin case else chkUser3 = cint(rsCheck("M_LEVEL")) End Select end if end if rsCheck.close set rsCheck = nothing end function %>