<% '################################################################################# '## 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 request("ARCHIVE") = "true" then strActivePrefix = strTablePrefix & "A_" ArchiveView = "true" else strActivePrefix = strTablePrefix ArchiveView = "" end if 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 " & strActivePrefix & "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 " & strActivePrefix & "REPLY " strSql = strSql & " WHERE 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 " & 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 = 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 = 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 " & strActivePrefix & "TOPICS " strSql = strSql & " SET " & strActivePrefix & "TOPICS.T_REPLIES = " & strActivePrefix & "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 " & strActivePrefix & "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 " & 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") else strLast_Post = "" strLast_Post_Author = "" 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 " & 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 end if %>

Reply Deleted!

(Remember to Refresh your browser.)

<% Else %>

No Permissions to Delete Reply

Go Back to Re-Authenticate

<% end if %> <% Else %>

No Permissions to Delete Reply

Go Back to Re-Authenticate

<% 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(" & strActivePrefix & "REPLY.REPLY_ID) AS cnt " strSql = strSql & " FROM " & strActivePrefix & "REPLY " strSql = strSql & " WHERE " & strActivePrefix & "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 " & strActivePrefix & "TOPICS.T_STATUS " strSql = strSql & " FROM " & strActivePrefix & "TOPICS " strSql = strSql & " WHERE " & strActivePrefix & "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 " & strActivePrefix & "TOPICS " strSql = strSql & " WHERE " & strActivePrefix & "TOPICS.TOPIC_ID = " & cint(delAr(i)) my_Conn.Execute strSql '## Forum_SQL - Delete all replys related to the topics strSql = "DELETE FROM " & strActivePrefix & "REPLY " strSql = strSql & " WHERE " & strActivePrefix & "REPLY.TOPIC_ID = " & cint(delAr(i)) my_Conn.Execute strSql '## 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 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

<% end if %> <% Else %>

No Permissions to Delete Topic

Go Back to Re-Authenticate

<% end if else if Mode_Type = "DeleteForum" then mLev = cint(chkUser(strDBNTUserName, Request.Form("Pass"))) if mLev > 0 then '## is Member if mLev = 4 then delAr = split(Forum_ID, ",") for i = 0 to ubound(delAr) '## Forum_SQL - Delete all replys related to the topics strSql = "DELETE FROM " & strActivePrefix & "REPLY " strSql = strSql & " WHERE FORUM_ID = " & cint(delAr(i)) my_Conn.Execute strSql '## Forum_SQL - Delete the actual topics strSql = "DELETE FROM " & strActivePrefix & "TOPICS " strSql = strSql & " WHERE " & strActivePrefix & "TOPICS.FORUM_ID = " & cint(delAr(i)) my_Conn.Execute strSql '## Forum_SQL - Delete the moderators strSql = "DELETE FROM " & strActivePrefix & "MODERATOR " strSql = strSql & " WHERE " & strActivePrefix & "MODERATOR.FORUM_ID = " & cint(delAr(i)) my_Conn.Execute strSql '## Forum_SQL - Delete the actual forums strSql = "DELETE FROM " & strActivePrefix & "FORUM " strSql = strSql & " WHERE " & strActivePrefix & "FORUM.FORUM_ID = " & cint(delAr(i)) my_Conn.Execute strSql '## Updating the counts for the forum is only needed if not '## in the archive if ArchiveView = "" then '## Forum_SQL - count total number of replies 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.R_STATUS <= 1 " rs.Open strSql, my_Conn risreply = rs("cnt") rs.close set rs = nothing set rs = Server.CreateObject("ADODB.Recordset") '## Forum_SQL - count total number of Topics in Topics table strSql = "SELECT count(" & strTablePrefix & "TOPICS.TOPIC_ID) AS cnt " strSql = strSql & " FROM " & strTablePrefix & "TOPICS " strSql = strSql & " WHERE " & strTablePrefix & "TOPICS.T_STATUS <= 1 " rs.Open strSql, my_Conn rispost = rs("cnt") rs.close set rs = nothing '## Forum_SQL - Update total topics and posts in Totals table strSql = "UPDATE " & strTablePrefix & "TOTALS " strSql = strSql & " SET " & strTablePrefix & "TOTALS.P_COUNT = " & cint(risreply + rispost) strSql = strSql & ", " & strTablePrefix & "TOTALS.T_COUNT = " & cint(rispost) my_Conn.Execute strSql end if next %>

Forum Deleted!

<% Else %>

No Permissions to Delete Forum

Go Back to Re-Authenticate

<% end if %> <% Else %>

No Permissions to Delete Forum

Go Back to Re-Authenticate

<% end if else if Mode_Type = "DeleteCategory" then mLev = cint(chkUser(strDBNTUserName, Request.Form("Pass"))) if mLev > 0 then '## is Member if mLev = 4 then delAr = split(Cat_ID, ",") for i = 0 to ubound(delAr) '## Forum_SQL - Delete all replys related to the topics strSql = "DELETE FROM " & strTablePrefix & "REPLY " strSql = strSql & " WHERE " & strTablePrefix & "REPLY.CAT_ID = " & cint(delAr(i)) my_Conn.Execute strSql '## Forum_SQL - Delete the actual topics strSql = "DELETE FROM " & strTablePrefix & "TOPICS " strSql = strSql & " WHERE " & strTablePrefix & "TOPICS.CAT_ID = " & cint(delAr(i)) my_Conn.Execute strSql '## Forum_SQL - Delete the actual forums strSql = "DELETE FROM " & strTablePrefix & "FORUM " strSql = strSql & " WHERE " & strTablePrefix & "FORUM.CAT_ID = " & cint(delAr(i)) my_Conn.Execute strSql '## Forum_SQL - Delete the actual category strSql = "DELETE FROM " & strTablePrefix & "CATEGORY " strSql = strSql & " WHERE " & strTablePrefix & "CATEGORY.CAT_ID = " & cint(delAr(i)) my_Conn.Execute strSql '## Forum_SQL - count total number of replies 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.R_STATUS <= 1 " rs.Open strSql, my_Conn risreply = rs("cnt") rs.close set rs = nothing '## Forum_SQL - count total number of Topics in Topics table set rs = Server.CreateObject("ADODB.Recordset") strSql = "SELECT count(" & strTablePrefix & "TOPICS.TOPIC_ID) AS cnt " strSql = strSql & " FROM " & strTablePrefix & "TOPICS " strSql = strSql & " WHERE " & strTablePrefix & "TOPICS.T_STATUS <= 1 " rs.Open strSql, my_Conn rispost = rs("cnt") rs.close P_Count = cint(risreply + rispost) T_Count = cint(rispost) '## Forum_SQL - Update total topics and posts in Totals table strSql = "UPDATE " & strTablePrefix & "TOTALS " strSql = strSql & " SET " & strTablePrefix & "TOTALS.P_COUNT = " & P_Count & " " strSql = strSql & ", " & strTablePrefix & "TOTALS.T_COUNT = " & T_Count & " " my_Conn.Execute strSql next %>

Category Deleted!

<% else %>

No Permissions to Delete Category

Go Back to Re-Authenticate

<% end if %> <% else %>

No Permissions to Delete Category

Go Back to Re-Authenticate

<% end if else if Mode_Type = "DeleteMember" then mLev = cint(chkUser(STRdbntUserName, Request.Form("Pass"))) if mLev > 0 then '## is Member if mLev = 4 then '## Forum_SQL - Remove the member from the moderator table strSql = "DELETE FROM " & strTablePrefix & "MODERATOR " strSql = strSql & " WHERE " & strTablePrefix & "MODERATOR.MEMBER_ID = " & Member_ID my_Conn.Execute (strSql) '## Forum_SQL - Select postcount strSql = "SELECT COUNT(T_AUTHOR) AS POSTCOUNT " strSql = strSql & " FROM " & strTablePrefix & "TOPICS " strSql = strSql & " WHERE T_AUTHOR = " & Member_ID set rs = my_Conn.Execute (strSql) if not rs.eof then intPostcount = rs("POSTCOUNT") else intPostcount = 0 end if rs.close '## Forum_SQL - Select postcount strSql = "SELECT COUNT(R_AUTHOR) AS REPLYCOUNT " strSql = strSql & " FROM " & strTablePrefix & "REPLY " strSql = strSql & " WHERE R_AUTHOR = " & Member_ID set rs = my_Conn.Execute (strSql) if not rs.eof then intReplycount = rs("REPLYCOUNT") else intReplycount = 0 end if rs.close '## Forum_SQL - Select Archived postcount strSql = "SELECT COUNT(T_AUTHOR) AS POSTCOUNT " strSql = strSql & " FROM " & strTablePrefix & "A_TOPICS " strSql = strSql & " WHERE T_AUTHOR = " & Member_ID set rs = my_Conn.Execute (strSql) if not rs.eof then intA_Postcount = rs("POSTCOUNT") else intA_Postcount = 0 end if rs.close '## Forum_SQL - Select postcount strSql = "SELECT COUNT(R_AUTHOR) AS REPLYCOUNT " strSql = strSql & " FROM " & strTablePrefix & "A_REPLY " strSql = strSql & " WHERE R_AUTHOR = " & Member_ID set rs = my_Conn.Execute (strSql) if not rs.eof then intA_Replycount = rs("REPLYCOUNT") else intA_Replycount = 0 end if rs.close if ((intReplycount + intPostCount + intA_Replycount + intA_PostCount) = 0) then '## Forum_SQL - Delete the Member - Member has no posts strSql = "DELETE FROM " & strMemberTablePrefix & "MEMBERS " strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS.MEMBER_ID = " & Member_ID my_Conn.Execute strSql else '## Forum_SQL - disable account - Member has posts, cannot delete just disable account strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS " strSql = strSql & " SET " & strMemberTablePrefix & "MEMBERS.M_STATUS = " & 0 strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_EMAIL = ' '" strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_LEVEL = " & 1 strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_NAME = 'n/a'" strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_COUNTRY = ' '" strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_TITLE = 'deleted'" strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_HOMEPAGE = ' '" strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_AIM = ' '" strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_YAHOO = ' '" strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_ICQ = ' '" strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS.MEMBER_ID = " & Member_ID my_Conn.Execute strSql end if '## Forum_SQL - Update total of Members in Totals table strSql = "UPDATE " & strTablePrefix & "TOTALS " strSql = strSql & " SET " & strTablePrefix & "TOTALS.U_COUNT = " & strTablePrefix & "TOTALS.U_COUNT - " & 1 my_Conn.Execute strSql %>

Member Deleted!

<% else %>

No Permissions to Delete a Member

Go Back to Re-Authenticate

<% end if %> <% else %>

No Permissions to Delete a Member

Go Back to Re-Authenticate

<% end if else %>

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 %>

<% if Mode_Type = "Category" then Response.Write("DeleteCategory")%><% if Mode_Type = "Forum" then Response.Write("DeleteForum")%><% if Mode_Type = "Topic" then Response.Write("DeleteTopic")%><%if Mode_Type = "Reply" then Response.Write("DeleteReply")%>" method=post id=Form1 name=Form1>
<% if strAuthType="db" then %> <% else %> <% if strAuthType="nt" then %> <% end if %> <% end if %>
align=right nowrap>User Name: >" size=20>
align=right nowrap>Password: >" size=20>
align=right nowrap>NT Account: ><%=Session(strCookieURL & "userid")%>
colspan=2 align=center>
<% 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, " & strActivePrefix & "REPLY.R_AUTHOR " strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS, " & strActivePrefix & "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 " & strActivePrefix & "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 %>