📄 delpost.asp
字号:
<!-- #include file="Setup.asp" --><%
HtmlTop
if CookieUserName=empty then error("您还未<a href=Login.asp?ReturnUrl="&ReturnUrl&">登录</a>")
ThreadID=RequestInt("ThreadID")
PostID=RequestInt("PostID")
sql="Select * From [Wo_Threads] where ThreadID="&ThreadID&""
Rs.Open sql,Conn,1
if Rs.eof or Rs.bof then error"<li>系统不存在该主题的资料"
ForumID=Rs("ForumID")
PostsTableName=Rs("PostsTableName")
Topic=Rs("Topic")
Rs.close
sql="select * from [Wo_Forums] where ForumID="&ForumID&""
Set Rs=Conn.Execute(sql)
ForumName=Rs("ForumName")
Moderated=Rs("Moderated")
ParentID=Rs("ParentID")
GroupID=Rs("GroupID")
Rs.close
%>
<!-- #include file="Utility/ForumPermissions.asp" -->
<%
if PermissionDelete=0 then error("您的<a href=ShowForumPermissions.asp?ForumID="&ForumID&">权限</a>不够")
if Conn.Execute("Select IsDel From [Wo_Threads] where ThreadID="&ThreadID&" ")(0)=1 then error("此主题已经在回收站了")
sql="select * from [Wo_Posts"&PostsTableName&"] where PostID="&PostID&""
Rs.Open sql,Conn,1,3
if Rs.eof or Rs.bof then error"<li>系统不存在该主题的资料"
if Rs("PostAuthor")<>CookieUserName and PermissionManage=0 then error("您的<a href=ShowForumPermissions.asp?ForumID="&ForumID&">权限</a>不够!")
Subject=Rs("Subject")
PostBody=Rs("Body")
Rs.close
if Request.ServerVariables("Request_method") <> "POST" then
%>
<div id="CommonBreadCrumbArea"><%ClubTree%> → <%ForumTree(ParentID)%><%=ForumTreeList%> <a href=ShowForum.asp?ForumID=<%=ForumID%>><%=ForumName%></a> → <a href="ShowPost.asp?ThreadID=<%=ThreadID%>"><%=Topic%></a> → 删除主题</div>
<script type="text/javascript" src="Utility/selectNodes.js"></script>
<script language="JavaScript">
var XmlDom;
if (window.ActiveXObject) {//IE浏览器
XmlDom= new ActiveXObject("Microsoft.XMLDOM");
} else if (document.implementation && document.implementation.createDocument) { //其它浏览器
XmlDom= document.implementation.createDocument("","",null);
}
XmlDom.async = false;
XmlDom.load("Utility/Templates.xml");
var XmlDomRoot = XmlDom.documentElement;
TemplateNode = XmlDomRoot.getElementsByTagName('template');
function PostDelReason(i) { //原因
var ElementNode = TemplateNode[i].selectSingleNode('body');
ReasonText = GetNodeValue(ElementNode);
ReasonText = ReasonText.replace('\[SiteName\]','<%=SiteConfig("SiteName")%>');
document.getElementById("ReasonBody").value = ReasonText;
}
function DelReasonOptions() { //原因下拉框
for( var i=0;i<TemplateNode.length;i++) {
var ElementNode = TemplateNode[i].selectSingleNode('title');
document.write("<option value="+TemplateNode[i].getAttributeNode('id').nodeValue+">"+GetNodeValue(ElementNode)+"</option>");
}
}
function GetNodeValue(objXmlElement)
{
if(window.ActiveXObject) { //IE浏览器
return objXmlElement.text;
}
else if(window.XMLHttpRequest) { //其它浏览器
try {
return objXmlElement.firstChild.nodeValue;
}
catch(ex) {
return "";
}
}
}
</script>
<form method="Post" action="?<%=Request.ServerVariables("Query_String")%>">
<table cellspacing="1" cellpadding="0" width=900 id=CommonListArea>
<tr id=CommonListTitle3>
<td colspan="2" align="center">删除主题</td>
</tr>
<tr id=CommonListCell height="30">
<td width="200">标 题:</td>
<td><%=Subject%></td>
</tr>
<tr id=CommonListCell height="30">
<td width="200">删除人:</td>
<td><%=CookieUserName%></td>
</tr>
<tr id=CommonListCell height="30">
<td>删除主题的原因:</td>
<td><select name="PostDeleteReason" onchange="PostDelReason(this.options[this.selectedIndex].value)"><script language="JavaScript">DelReasonOptions()</script></select></td>
</tr>
<tr id=CommonListCell>
<td>原因:</td>
<td><textarea id="ReasonBody" name="ReasonBody" rows="12" cols="80"></textarea></td>
</tr>
<tr id=CommonListCell>
<td colspan="2" align="center"><input type="submit" value=" 确定 "><input onclick="history.back()" type="button" value=" 取消 "></td>
</tr>
</table>
</form>
<%
HtmlBottom
end if
sql="select * from [Wo_Posts"&PostsTableName&"] where PostID="&PostID&""
Rs.Open sql,Conn,1
if Rs.eof or Rs.bof then error"<li>系统不存在该主题的资料"
if Rs("PostAuthor")<>CookieUserName and PermissionManage=0 then error("您的<a href=ShowForumPermissions.asp?ForumID="&ForumID&">权限</a>不够!")
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 [Wo_Users] set TotalPosts=TotalPosts-1,UserMoney=UserMoney-2,experience=experience-2 where UserName='"&PostAuthor&"'")
Conn.execute("update [Wo_Threads] set ThreadTop=0,IsDel=1,lastname='"&CookieUserName&"',lasttime="&SqlNowString&" where ThreadID="&ThreadID&"")
Conn.execute("update [Wo_Forums] set TotalThreads=TotalThreads-1,TotalPosts=TotalPosts-1 where ForumID="&ForumID&"")
else
succtitle="删除回复成功"
Conn.execute("Delete from [Wo_Posts"&PostsTableName&"] where PostID="&PostID&"")
Conn.execute("update [Wo_Users] set TotalPosts=TotalPosts-1,UserMoney=UserMoney-1,experience=experience-1 where UserName='"&PostAuthor&"'")
sql="select top 1 * from [Wo_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 [Wo_Threads] set TotalReplies=TotalReplies-1,LastName='"&LastName&"',LastTime='"&LastTime&"' where ThreadID="&ThreadID&"")
Conn.execute("update [Wo_Forums] set TotalPosts=TotalPosts-1 where ForumID="&ForumID&"")
end if
UpForumMostRecent(ForumID)
sql="insert into [WO_PrivateMessages](SenderUserName,RecipientUserName,Subject,Body) values ('"&CookieUserName&"','"&PostAuthor&"','<font color=0000FF>【系统通知】:您在 "&PostDate&" 发表于 "&SiteConfig("SiteName")&" 的主题已被 "&CookieUserName&" 删除!</font>','<br>原因如下:"&HTMLEncode(Request("ReasonBody"))&"')"
Conn.Execute(SQL)
Conn.execute("update [Wo_Users] set NewMessage=NewMessage+1 where UserName='"&PostAuthor&"'")
if succtitle="" then error("无效命令")
Log(""&succtitle&",标题:"&Subject&",主题ID:"&ThreadID&",主题ID:"&PostID&"")
Message="<li>"&succtitle&"<li><a href=ShowForum.asp?ForumID="&ForumID&">返回群组</a>"
succeed Message,"ShowForum.asp?ForumID="&ForumID&""
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -