%
'##################################################################################################
'## Snitz Forums 2000 v3.4.07
'##################################################################################################
'## Copyright (C) 2000-09 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 Session(strCookieURL & "Approval") <> "15916941253" then
scriptname = split(request.servervariables("SCRIPT_NAME"),"/")
Response.Redirect "admin_login.asp?target=" & scriptname(ubound(scriptname))
end if
Response.Write "
" & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & getCurrentIcon(strIconFolderOpen,"","") & " All Forums " & vbNewLine & _
" " & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpen,"","") & " Admin Section " & vbNewLine & _
" " & getCurrentIcon(strIconBlank,"","") & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpenTopic,"","") & " Forum Cleanup Tools
| " & vbNewLine & _
"
" & vbNewLine & _
"
" & vbNewLine
strToDo = Request.QueryString("action")
strTempMemID = cLng(Request.QueryString("member_id"))
strTempForumID = cLng(Request.QueryString("forum_id"))
strTempDelMember = Request.QueryString("delmember")
strTempDelReply = Request.QueryString("delreply")
Select Case LCase(strToDo)
Case "deletememtopics"
if Request.QueryString("c") = "t" then
DelMemTopicExec
else
response.write("
Go ahead with requested operation?
Yes | No
")
end if
Case "delforumtopics"
if Request.QueryString("c") = "t" then
DelForumTopicsExec
else
response.write("
Go ahead with requested operation?
Yes | No
")
end if
Case "deletememtopicsdone"
Response.write("
All Done!
" & vbNewLine & _
"Back to Forum Cleanup Tools
")
Case else
response.write("" & vbNewLine & _
"" & vbNewLine & _
"| Delete Topics by Member | " & vbNewLine & _
"
" & vbNewLine & _
"" & vbNewLine & _
"| ")
DelMemTopicHTML()
Response.write(" | " & vbNewLine & _
"
" & vbNewLine & _
"" & vbNewLine & _
"| Delete Topics by Forum> | " & vbNewLine & _
"
" & vbNewLine & _
"" & vbNewLine & _
"| ")
DelForumTopicsHTML()
response.write(" | " & vbNewLine & _
"
" & vbNewLine &_
"
")
End Select
WriteFooter
Sub DelForumTopicsHTML()
response.write("")
End Sub
Sub DelMemTopicHTML()
response.write("")
End Sub
Sub DelMemTopicExec()
if strTempDelReply = "delreply" and not(strTempMemID = 1) then
strsql = "SELECT TOPIC_ID, REPLY_ID, FORUM_ID, R_STATUS FROM " & strTablePrefix & "REPLY WHERE R_AUTHOR=" & strTempMemID
set rs = my_Conn.execute(strsql)
do while not (rs.eof)
strTempRSreplyID = rs("REPLY_ID")
strTempRStopicID = rs("TOPIC_ID")
Reply_Status = rs("R_STATUS")
Forum_ID = rs("FORUM_ID")
strsql = "DELETE FROM " & strTablePrefix & "REPLY WHERE REPLY_ID=" & strTempRSreplyID
my_conn.execute(strsql),,adCmdText + adExecuteNoRecords
strSql = "SELECT REPLY_ID, R_DATE, R_AUTHOR, R_STATUS"
strSql = strSql & " FROM " & strTablePrefix & "REPLY "
strSql = strSql & " WHERE TOPIC_ID = " & strTempRStopicID & " "
strSql = strSql & " AND R_STATUS <= 1 "
strSql = strSql & " ORDER BY R_DATE DESC"
set trs = my_Conn.Execute (strSql)
if not(trs.eof or trs.bof) then
strLast_Post_Reply_ID = trs("REPLY_ID")
strLast_Post = trs("R_DATE")
strLast_Post_Author = trs("R_AUTHOR")
end if
if (trs.eof or trs.bof) or IsNull(strLast_Post) or IsNull(strLast_Post_Author) then
set rs2 = Server.CreateObject("ADODB.Recordset")
strSql = "SELECT T_AUTHOR, T_DATE "
strSql = strSql & " FROM " & strTablePrefix & "TOPICS "
strSql = strSql & " WHERE TOPIC_ID = " & strTempRStopicID & " "
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
'''''''''''''''''''''
if Reply_Status <= 1 then
strSql = "UPDATE " & strTablePrefix & "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 = " & strTempRStopicID
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 " & strTablePrefix & "TOPICS "
strSql = strSql & " WHERE FORUM_ID = " & Forum_ID & " "
strSql = strSql & " ORDER BY T_LAST_POST DESC"
set srs = my_Conn.Execute (strSql)
if not srs.eof then
strLast_Post = srs("T_LAST_POST")
strLast_Post_Author = srs("T_LAST_POST_AUTHOR")
strLast_Post_Topic_ID = srs("TOPIC_ID")
strLast_Post_Reply_ID = srs("T_LAST_POST_REPLY_ID")
else
strLast_Post = ""
strLast_Post_Author = "NULL"
strLast_Post_Topic_ID = 0
strLast_Post_Reply_ID = 0
end if
srs.Close
set srs = nothing
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
else
strSql = "UPDATE " & strTablePrefix & "TOPICS "
strSql = strSql & " SET T_UREPLIES = T_UREPLIES - 1 "
strSql = strSql & " WHERE TOPIC_ID = " & Topic_ID
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
end if
'''''''''''''''''''''
rs.movenext
loop
set rs = nothing
end if
'## Delete all stuff associated with topics being deleted...
strsql = "SELECT TOPIC_ID FROM " & strTablePrefix & "TOPICS WHERE T_AUTHOR=" & strTempMemID
set rs = my_conn.execute(strsql)
if not(rs.eof) then
do while not(rs.eof)
strsql = "DELETE FROM " & strTablePrefix & "REPLY WHERE TOPIC_ID=" & rs("TOPIC_ID")
my_conn.execute(strsql)
strsql = "DELETE FROM " & strTablePrefix & "SUBSCRIPTIONS WHERE TOPIC_ID=" & rs("TOPIC_ID")
my_conn.execute(strsql)
rs.movenext
loop
end if
set rs = nothing
'## End delete stuff
strsql = "DELETE FROM " & strTablePrefix & "TOPICS WHERE T_AUTHOR=" & strTempMemID
my_Conn.execute(strsql)
if strTempDelMember = "delmember" and not(strTempMemID = 1) then
strsql = "DELETE FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID = " & strTempMemID
my_conn.execute(strsql)
end if
Response.write("
The Requested Operation is in progress, please wait..." & vbNewLine & _
"
")
End Sub
Sub DelForumTopicsExec()
'Delete all the replies for the indicated forum
strsql = "DELETE FROM " & strTablePrefix & "REPLY WHERE FORUM_ID=" & strTempForumID
my_conn.execute(strsql),,adCmdText + adExecuteNoRecords
'Delete all the topics from the forum
strsql = "DELETE FROM " & strTablePrefix & "TOPICS WHERE FORUM_ID=" & strTempForumID
my_conn.execute(strsql)
'Update the last post info in the FORUM table
strsql = "UPDATE " & strTablePrefix & "FORUM "
strsql = strsql & "SET F_LAST_POST='', F_LAST_POST_AUTHOR=0, F_LAST_POST_REPLY_ID=0, F_LAST_POST_TOPIC_ID=0 "
strsql = strsql & "WHERE FORUM_ID=" & strTempForumID
my_conn.execute(strsql)
Response.write("
The Requested Operation is in progress, please wait..." & vbNewLine & _
"
")
End Sub
%>