%
HtmlTop
if CookieUserName=empty then error("您还未登录论坛")
ThreadID=RequestInt("ThreadID")
PostID=RequestInt("PostID")
sql="Select * From [BBSXP_Threads] where ThreadID="&ThreadID&""
Rs.Open sql,Conn,1
if Rs.eof or Rs.bof then error"
系统不存在该帖子的资料"
ForumID=Rs("ForumID")
PostsTableName=Rs("PostsTableName")
Topic=Rs("Topic")
Rs.close
sql="select * from [BBSXP_Forums] where ForumID="&ForumID&""
Set Rs=Conn.Execute(sql)
ForumName=Rs("ForumName")
Moderated=Rs("Moderated")
ParentID=Rs("ParentID")
GroupID=Rs("GroupID")
Rs.close
%>
<%
if PermissionDelete=0 then error("您的权限不够")
if Conn.Execute("Select IsDel From [BBSXP_Threads] where ThreadID="&ThreadID&" ")(0)=1 then error("此帖子已经在回收站了")
sql="select * from [BBSXP_Posts"&PostsTableName&"] where PostID="&PostID&""
Rs.Open sql,Conn,1,3
if Rs.eof or Rs.bof then error"系统不存在该帖子的资料"
if Rs("PostAuthor")<>CookieUserName and PermissionManage=0 then error("您的权限不够!")
Subject=Rs("Subject")
PostBody=Rs("Body")
Rs.close
if Request.ServerVariables("Request_method") <> "POST" then
%>
<%
HtmlBottom
end if
sql="select * from [BBSXP_Posts"&PostsTableName&"] where PostID="&PostID&""
Rs.Open sql,Conn,1
if Rs.eof or Rs.bof then error"系统不存在该帖子的资料"
if Rs("PostAuthor")<>CookieUserName and PermissionManage=0 then error("您的权限不够!")
PostID=Rs("PostID")
ThreadID=Rs("ThreadID")
ParentID=Rs("ParentID")
PostAuthor=Rs("PostAuthor")
PostDate=Rs("PostDate")
Rs.close
if ParentID=0 then
succtitle="删除主题成功"
Conn.execute("update [BBSXP_Users] set TotalPosts=TotalPosts-1,UserMoney=UserMoney+"&SiteConfig("IntegralDeleteThread")&",experience=experience+"&SiteConfig("IntegralDeleteThread")&" where UserName='"&PostAuthor&"'")
Conn.execute("update [BBSXP_Threads] set ThreadTop=0,IsDel=1,lastname='"&CookieUserName&"',lasttime="&SqlNowString&" where ThreadID="&ThreadID&"")
Conn.execute("update [BBSXP_Forums] set TotalThreads=TotalThreads-1,TotalPosts=TotalPosts-1 where ForumID="&ForumID&"")
else
succtitle="删除回帖成功"
Conn.execute("Delete from [BBSXP_Posts"&PostsTableName&"] where PostID="&PostID&"")
Conn.execute("update [BBSXP_Users] set TotalPosts=TotalPosts-1,UserMoney=UserMoney+"&SiteConfig("IntegralDeletePost")&",experience=experience+"&SiteConfig("IntegralDeletePost")&" where UserName='"&PostAuthor&"'")
sql="select top 1 * from [BBSXP_Posts"&PostsTableName&"] where ThreadID="&ThreadID&" order by PostID DESC"
Rs.Open sql,Conn,1
LastName=Rs("PostAuthor")
LastTime=Rs("PostDate")
Rs.close
Conn.execute("update [BBSXP_Threads] set TotalReplies=TotalReplies-1,LastName='"&LastName&"',LastTime='"&LastTime&"' where ThreadID="&ThreadID&"")
Conn.execute("update [BBSXP_Forums] set TotalPosts=TotalPosts-1 where ForumID="&ForumID&"")
end if
UpForumMostRecent(ForumID)
MailAddRecipient=Conn.execute("select UserEmail from [BBSXP_Users] where UserName='"&PostAuthor&"'")(0)
MailSubject="("&SiteConfig("SiteName")&")帖子已删除:"&Subject&""
MailBody = MailBody &"您好,"&PostAuthor&"!
您在 "&PostDate&" 发表于 "&SiteConfig("SiteName")&" 的帖子已被 "&CookieUserName&" 删除"
MailBody = MailBody &"
"&Subject&"
"
MailBody = MailBody &"--------------------------------------------------------
"
MailBody = MailBody &""&PostBody&"
"
MailBody = MailBody &"--------------------------------------------------------
"
MailBody = MailBody &HTMLEncode(Request("ReasonBody"))
SendMail MailAddRecipient,MailSubject,MailBody
if succtitle="" then error("无效命令")
Log(""&succtitle&",标题:"&Subject&",主题ID:"&ThreadID&",帖子ID:"&PostID&"")
Message=""&succtitle&"返回论坛"
succeed Message,"ShowForum.asp?ForumID="&ForumID&""
%>