📄 pop_moderate.asp
字号:
else
do until rsLoop.EOF
LoopCatId = rsLoop("CAT_ID")
LoopForumID = rsLoop("FORUM_ID")
LoopTopicID = rsLoop("TOPIC_ID")
LoopMemberName = rsLoop("M_NAME")
LoopMemberID = rsLoop("MEMBER_ID")
if Comments <> "" then
Send_Comment_Email LoopMemberName, LoopMemberID, LoopCatID, LoopForumID, LoopTopicID, 0
end if
strSql = "DELETE FROM " & strTablePrefix & "TOPICS "
strSql = strSql & " WHERE CAT_ID = " & LoopCatID
strSql = strSql & " AND FORUM_ID = " & LoopForumID
strSql = strSql & " AND TOPIC_ID = " & LoopTopicID
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
' -- If approving, make sure to update the appropriate counts..
rsLoop.MoveNext
loop
end if
rsLoop.Close
set rsLoop = nothing
end if
' Update the replies if appropriate
strSql = "SELECT R.CAT_ID, " & _
"R.FORUM_ID, " & _
"R.TOPIC_ID, " & _
"R.REPLY_ID, " & _
"R.R_STATUS, " & _
"R.R_DATE as Post_Date, " & _
"M.M_NAME, " & _
"M.MEMBER_ID " & _
" FROM " & strTablePrefix & "REPLY R, " & strMemberTablePrefix & "MEMBERS M" & _
" WHERE (R.R_Status = 2 OR R.R_Status = 3) " & _
" AND R.R_AUTHOR = M.MEMBER_ID "
if ModLevel <> "BOARD" then
if ModLevel = "CAT" then
strSql = strSql & " AND R.CAT_ID = " & CatID
elseif ModLevel = "FORUM" then
strSql = strSql & " AND R.FORUM_ID = " & ForumID
elseif ModLevel = "TOPIC" or ModLevel = "ALLPOSTS" then
strSql = strSql & " AND R.TOPIC_ID = " & TopicID
else
strSql = strSql & " AND R.REPLY_ID = " & ReplyID
end if
end if
set rsLoop = my_Conn.Execute (strSql)
if rsLoop.EOF or rsLoop.BOF then
' Do nothing - No records matching the criteria were found
else
do until rsLoop.EOF
if Comments <> "" then
Send_Comment_Email rsLoop("M_NAME"), rsLoop("MEMBER_ID"), rsLoop("CAT_ID"), rsLoop("FORUM_ID"), rsLoop("TOPIC_ID"), rsLoop("REPLY_ID")
end if
if rsLoop("R_STATUS") = 2 then
strSql = "UPDATE " & strTablePrefix & "TOPICS "
strSql = strSql & " SET T_UREPLIES = T_UREPLIES - 1 "
strSql = strSql & " WHERE TOPIC_ID = " & rsLoop("TOPIC_ID")
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
end if
StrSql = "DELETE FROM " & strTablePrefix & "REPLY "
StrSql = StrSql & " WHERE REPLY_ID = " & rsLoop("REPLY_ID")
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
rsLoop.MoveNext
loop
end if
rsLoop.Close
set rsLoop = nothing
' ## Build final result message
if ModLevel = "BOARD" then
Result = "All Topics and Replies have "
elseif ModLevel = "CAT" then
Result = "All Topics and Replies in this Category have "
elseif ModLevel = "FORUM" then
Result = "All Topics and Replies in this Forum have "
elseif ModLevel = "TOPIC" then
Result = "This Topic has "
elseif ModLevel = "ALLPOSTS" then
Result = "All posts for this topic have "
else
Result = "This Reply has "
end if
if Mode = 2 then
Result = Result & " Been Placed on Hold."
elseIf Mode = 3 then
Result = Result & " Been Deleted."
else
Result = Result & " Been Approved."
end if
Response.Write " <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>" & Result & "</font></p>" & vbNewline & _
" <script language=""javascript1.2"">self.opener.location.reload();</script>" & vbNewLine
end sub
' ## ModeForm - This is the form which is used to determine exactly what the admin/moderator wants
' ## to do with the posts he is working on.
sub ModeForm
Response.Write " <form action=""pop_moderate.asp"" method=""post"" id=""Form1"" name=""Form1"">" & vbNewline & _
" <input type=""hidden"" name=""REPLY_ID"" value=""" & ReplyID & """>" & vbNewline & _
" <input type=""hidden"" name=""TOPIC_ID"" value=""" & TopicID & """>" & vbNewline & _
" <input type=""hidden"" name=""FORUM_ID"" value=""" & ForumID & """>" & vbNewline & _
" <input type=""hidden"" name=""CAT_ID"" value=""" & CatID & """>" & vbNewline & _
" <table border=""0"" width=""75%"" cellspacing=""0"" cellpadding=""0"">" & vbNewline & _
" <tr>" & vbNewline & _
" <td bgcolor=""" & strPopUpBorderColor & """>" & vbNewline & _
" <table border=""0"" width=""100%"" cellspacing=""1"" cellpadding=""1"">" & vbNewline & _
" <tr>" & vbNewline & _
" <td bgColor=""" & strPopUpTableColor & """ align=""center"">" & vbNewline & _
" <b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewline & _
" <select name=""Mode"">" & vbNewline & _
" <option value=""1"" SELECTED>Approve</option>" & vbNewline & _
" <option value=""2"">Hold</option>" & vbNewline & _
" <option value=""3"">Delete</option>" & vbNewline & _
" </select>" & vbNewline
If ModLevel = "TOPIC" or ModLevel = "REPLY" then
Response.Write " this post" & vbNewline
Else
Response.Write " these posts" & vbNewline
End if
Response.Write " </font></b></td>" & vbNewline & _
" </tr>" & vbNewline
if strEmail = 1 then
Response.Write " <tr>" & vbNewline & _
" <td bgColor=""" & strPopUpTableColor & """ align=""center"">" & vbNewline & _
" <b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>COMMENTS:</font></b>" & vbNewline & _
" <textarea name=""Comments"" cols=""45"" rows=""6"" wrap=""VIRTUAL""></textarea><br />" & vbNewline & _
" <font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>The comments you type here<br />will be mailed to the author of the topic(s)<br /></font></td>" & vbNewline & _
" </tr>" & vbNewline
end if
Response.Write " <tr>" & vbNewline & _
" <td bgColor=""" & strPopUpTableColor & """ align=""center""><Input type=""Submit"" value=""Send"" id=""Submit1"" name=""Submit1""></td>" & vbNewline & _
" </tr>" & vbNewline & _
" </table>" & vbNewline & _
" </td>" & vbNewline & _
" </tr>" & vbNewline & _
" </table>" & vbNewline & _
" </form>" & vbNewline
end Sub
' ## UpdateForum - This will update the forum table by adding to the total
' ## posts (and total topics if appropriate),
' ## and will also update the last forum post date and poster if
' ## appropriate.
sub UpdateForum(UpdateType, ForumID, MemberID, PostDate, TopicID, ReplyID)
dim UpdateLastPost
' -- Check the last date/time to see if they need updating.
strSql = " SELECT F_LAST_POST "
strSql = strSql & " FROM " & strTablePrefix & "FORUM "
strSql = strSql & " WHERE FORUM_ID = " & ForumID
set RsCheck = my_Conn.Execute (strSql)
if rsCheck("F_LAST_POST") < PostDate then
UpdateLastPost = "Y"
end if
rsCheck.Close
set rsCheck = nothing
strSql = "UPDATE " & strTablePrefix & "FORUM "
strSql = strSql & " SET F_COUNT = F_COUNT + 1 "
if UpdateType = "Topic" then strSql = strSql & ", F_TOPICS = F_TOPICS + 1 "
if UpdateLastPost = "Y" then
strSql = strSql & ", F_LAST_POST = '" & PostDate & "'"
strSql = strSql & ", F_LAST_POST_AUTHOR = " & MemberID
strSql = strSql & ", F_LAST_POST_TOPIC_ID = " & TopicID
strSql = strSql & ", F_LAST_POST_REPLY_ID = " & ReplyID
end if
strSql = strSql & " WHERE FORUM_ID = " & ForumID
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
end sub
' ## UpdateTopic - This will update the T_REPLIES field (and T_LAST_POST , T_LAST_POSTER & T_UREPLIES if applicable)
' ## for the appropriate topic
sub UpdateTopic(TopicID, MemberID, PostDate, ReplyID)
dim UpdateLastPost
' -- Check the last date/time to see if they need updating.
strSql = " SELECT T_LAST_POST, T_UREPLIES "
strSql = strSql & " FROM " & strTablePrefix & "TOPICS "
strSql = strSql & " WHERE TOPIC_ID = " & TopicID
set RsCheck = my_Conn.Execute (strSql)
if rsCheck("T_LAST_POST") < PostDate then
UpdateLastPost = "Y"
end if
if rsCheck("T_UREPLIES") > 0 then
UpdateUReplies = "Y"
end if
rsCheck.Close
set rsCheck = nothing
strSql = "UPDATE " & strTablePrefix & "TOPICS "
strSql = strSql & " SET T_REPLIES = T_REPLIES + 1 "
if UpdateLastPost = "Y" then
strSql = strSql & ", T_LAST_POST = '" & PostDate & "'"
strSql = strSql & ", T_LAST_POST_AUTHOR = " & MemberID
strSql = strSql & ", T_LAST_POST_REPLY_ID = " & ReplyID
end if
if UpdateUReplies = "Y" then
strSql = strSql & ", T_UREPLIES = T_UREPLIES - 1 "
end if
strSQL = strSQL & " WHERE TOPIC_ID = " & TopicID
'Response.Write "strSql = " & strSql
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
end sub
' ## UpdateUser - This will update the members table by adding to the total
' ## posts (and total topics if appropriate), and will also update
' ## the last forum post date and poster if appropriate.
sub UpdateUser(MemberID, LForumID, PostDate)
dim UpdateLastPost
' -- Check to see if this post is the newest one for the member...
set rsCheck = my_Conn.Execute("SELECT M_LASTPOSTDATE FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID = " & MemberID)
if rsCheck("M_LASTPOSTDATE") < PostDate then
UpdateLastPost = "Y"
end if
rsCheck.Close
set rsCheck = nothing
set rsFCountMP = my_Conn.Execute("SELECT F_COUNT_M_POSTS FROM " & strTablePrefix & "FORUM WHERE FORUM_ID = " & LForumID)
ForumCountMPosts = rsFCountMP("F_COUNT_M_POSTS")
rsFCountMP.close
set rsFCountMP = nothing
if UpdateLastPost = "Y" then
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " SET M_LASTPOSTDATE = '" & PostDate & "'"
strSql = strSql & " WHERE MEMBER_ID = " & MemberID
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
end if
if ForumCountMPosts <> 0 then
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " SET M_POSTS = (M_POSTS + 1)"
strSql = strSql & " WHERE MEMBER_ID = " & MemberID
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
end if
end sub
'## Send_Comment_Email - This sub will send and e-mail to the poster and tell them what the moderator
'## or Admin did with their posts.
sub Send_Comment_Email (MemberName, pMemberID, CatID, ForumID, TopicID, ReplyID)
' -- Get the Admin/Moderator MemberID
AdminModeratorID = MemberID
' -- Get the Admin/Moderator Name
AdminModeratorName = strDBNTUserName
' -- Get the Admin/Moderator Email
strSql = "SELECT M_EMAIL FROM " & strMemberTablePrefix & "MEMBERS" & _
" WHERE MEMBER_ID = " & AdminModeratorID
set rsSub = my_Conn.Execute (strSql)
if rsSub.EOF or rsSub.BOF then
exit sub
else
AdminModeratorEmail = rsSub("M_EMAIL")
end if
' -- Get the Category Name and Forum Name
strSql = "SELECT C.CAT_NAME, F.F_SUBJECT " & _
" FROM " & strTablePrefix & "CATEGORY C, " & strTablePrefix & "FORUM F" & _
" WHERE C.CAT_ID = " & CatID & " AND F.FORUM_ID = " & ForumID
set rsSub = my_Conn.Execute (strSql)
if RsSub.Eof or RsSub.BOF then
' Do Nothing -- Should never happen
else
CatName = rsSub("CAT_NAME")
ForumName = rsSub("F_SUBJECT")
end if
' -- Get the topic title
strSql = "SELECT T.T_SUBJECT FROM " & strTablePrefix & "TOPICS T" & _
" WHERE T.TOPIC_ID = " & TopicId
set rsSub = my_Conn.Execute (strSql)
if rsSub.EOF or rsSub.BOF then
TopicName = ""
else
TopicName = rsSub("T_SUBJECT")
end if
rsSub.Close
set rsSub = Nothing
strSql = "SELECT M_EMAIL FROM " & strMemberTablePrefix & "MEMBERS" & _
" WHERE MEMBER_ID = " & pMemberID
set rsSub = my_Conn.Execute (strSql)
if rsSub.EOF or rsSub.BOF then
exit sub
else
MemberEmail = rsSub("M_EMAIL")
end if
strRecipientsName = MemberName
strRecipients = MemberEmail
strSubject = strForumTitle & " - Your post "
if Mode = 1 then
strSubject = strSubject & "has been approved "
elseif Mode = 2 then
strSubject = strSubject & "has been placed on hold "
else
strSubject = strSubject & "has been rejected "
end if
strMessage = "Hello " & MemberName & "." & vbNewline & vbNewline & _
" You made a "
if Reply = 0 then
strMessage = strMessage & "post "
else
strMessage = strMessage & "reply to the post "
end if
strMessage = strMessage & "in the " & ForumName & " forum entitled " & _
TopicName & ". " & AdminModeratorName & " has decided to "
if Mode = 1 then
strMessage = strMessage & "approve your post "
elseif Mode = 2 then
strMessage = strMessage & "place your post on hold "
else
strMessage = strMessage & "reject your post "
end if
strMessage = strMessage & " for the following reason: " & vbNewline & vbNewline & _
Comments & vbNewline & vbNewline & _
"If you have any questions, please contact " & AdminModeratorName & _
" at " & AdminModeratorEmail
%>
<!--#INCLUDE FILE="inc_mail.asp" -->
<%
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -