📄 editpost.asp
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--#include file="Includes/site-dataconn.asp" -->
<!--#include file="Includes/func-common.asp" -->
<!--#include file="Includes/site-config.asp" -->
<!--#include file="Includes/inc-common.asp" -->
<!--#include file="Includes/func-htmlcode.asp" -->
<%
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>
<html>
<head>
<title>// <%=Site_Name%> //</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK REL=stylesheet TYPE="text/css" HREF="Includes/site-style.css">
</head>
<body>
<!--#include file="Includes/inc-header.asp" -->
<%
if isnumeric(request.querystring("P")) = true then
'Retrieve forum, category name and post details from database, if it doesn't exist invalid forum was selected
set rsForums = server.createobject("adodb.recordset")
sqlForums = "SELECT FF.Forum_ID, FF.Forum_Name, FF.Forum_Allow_Images, FC.Category_Title, FC.Category_ID, FT.Topic_ID, FT.Topic_Title, FT.Topic_Forum_ID, FT.Topic_Status, FT.Topic_Type, FP.Post_ID, FP.Post_Topic_ID FROM Forum_Topics FT, Forum_Forums FF, Forum_Categories FC, Forum_Posts FP WHERE FP.Post_ID = "& clng(request.querystring("P")) &" AND FT.Topic_ID = FP.Post_Topic_ID AND FF.Forum_ID = FT.Topic_Forum_ID AND FC.Category_ID = FF.Forum_Category_ID AND FT.Topic_Type <> 0;"
rsForums.Open sqlForums, adoConn, adCMDText
if rsForums.eof or rsForums.bof then
rsForums.close
set rsForums = nothing
strMessage = "The post that you have seleceted could not be found. If you have followed a valid link please contact hte board administrator. Click <a href='default.asp'>here</a> if you are not redirected within 5 seconds."
strRedirectURL = "default.asp"
else
'Set categoy and forum name
strForum = rsForums("Forum_Name")
strForumID = rsForums("Forum_ID")
strImages = rsForums("Forum_Allow_Images")
strCategory = rsForums("Category_Title")
strCategoryID = rsForums("Category_ID")
strTopicID = rsForums("Topic_ID")
strTopic = rsForums("Topic_Title")
strTopicType = rsForums("Topic_Type")
strTopicStatus = rsForums("Topic_Status")
strPostID = clng(request.querystring("P"))
rsForums.close
set rsForums = nothing
end if
else
strMessage = "You have selected an invalid forum. Click <a href='default.asp'>here</a> if you are not redirected within 5 seconds."
strRedirectURL = "default.asp"
end if
'Check that the user is logged in.
if session("Username") = "" then
strMessage = "你必须先登陆本论坛. Click <a href='displayforum.asp?F="& strForumID &"'>here</a> if you are not redirected within 5 seconds."
strRedirectURL = "displayforum.asp?F="& strForumID
else
'Grab the post from the database
set rsEdit = server.createobject("adodb.recordset")
sqlEdit = "SELECT Post_ID, Post_Topic_ID, Post_Forum_ID, Post_User_ID, Post_Signature, Post_Title, Post_Text, Post_Time, Post_Index, User_Name FROM Forum_Posts, Forum_Users WHERE Post_ID = "& strPostID &" AND Forum_Users.User_ID = Forum_Posts.Post_User_ID;"
rsEdit.open sqlEdit, adoConn, CMDText
pSignature = rsEdit("Post_Signature")
pTitle = rsEdit("Post_Title")
pText = rsEdit("Post_Text")
pText = htmlcode(pText)
pName = rsEdit("User_Name")
pUserID = rsEdit("Post_User_ID")
pFirst = rsEdit("Post_Index")
pTime = rsEdit("Post_Time")
rsEdit.close
set rsEdit = nothing
'Check whether the current user is an admin/moderator
Admin = false
Moderator = false
User = false
if session("admin") = true then Admin = true
'Check if the user is in the administrators table or moderators table
set rsAdminCheck = server.createobject("adodb.recordset")
sqlAdminCheck = "SELECT Mod_ID FROM Forum_Moderator WHERE Mod_User_ID = "& session("UserID") &" AND Mod_Forum_ID = "& strForumID &";"
rsAdminCheck.open sqlAdminCheck, adoConn
if not (rsAdminCheck.eof or rsAdminCheck.bof) then
Moderator = true
end if
rsAdminCheck.close
set rsAdminCheck = nothing
'Check whether the current user is the author of the post we're about to edit
if session("userid") = pUserID then
User = true
end if
if strTopicStatus = 0 then
if Admin = false and Moderator = false then
strMessage = "This Topic has been locked by the forum administrators, you cannot make any further changes to your message. Click <a href=""javascript:history.go(-1)"">here</a> if you are not redirected within 5 seconds."
strRedirectURL = "javascript:history.go(-1)"
end if
end if
if Admin = false and Moderator = false and User = false then
strMessage = "You do not have the ability to edit/moderate other peoples messages. Click <a href=""javascript:history.go(-1)"" onMouseOver=""self.status=document.referrer;return true"">here</a> if you are not redirected within 5 seconds."
strRedirectURL = "javascript:history.go(-1)"
end if
end if
'Display error or continue
If strMessage <> "" then
%>
<table width="100%" border="0" cellspacing="1" cellpadding="3" align="center" class="main">
<tr valign="middle" class="title">
<td align="center"><%=Site_Name%> // Error</td>
</tr>
<tr valign="top" class="body">
<td align="center"><%=strMessage%></td>
</tr>
</table>
<META HTTP-EQUIV="Refresh" CONTENT="5; URL=<%=strRedirectURL%>">
<%
else
%>
<table border="0" cellspacing="0" cellpadding="2" align="center" class="plain">
<tr>
<td valign="top">
<a href="default.asp"><%=Site_Name%></a> >> <a href="displaycategory.asp?C=<%=strCategoryID%>"><%=strCategory%></a> >> <a href="displayforum.asp?F=<%=strForumID%>"><%=strForum%></a> >> <a href="displaytopic.asp?T=<%=strTopicID%>"><%=strTopic%></a><br>
<%=Site_Description%>
</td>
</tr>
</table>
<%
if (session("admin") = true or Moderator = true) then
%>
<table width="100%" border="0" cellspacing="1" cellpadding="3" align="center" class="main">
<form action="editing.asp?Action=Delete" method="post">
<tr valign="middle" class="title">
<td align="center" colspan="3"><%=Site_Name%> // 删除话题</td>
</tr>
<tr valign="top" class="body">
<td width="20" align="center" valign="middle"><input name="delete" type="checkbox" value="1"></td>
<td align="left" valign="middle">To Delete this post tick the box on the left and then click the delete button on the right.
<%
if pFirst = 1 then
%>
<br>Deleting this post will delete the entire thread.
<%
end if
%>
</td>
<td width="20" align="center" valign="middle">
<input name="PostID" type="hidden" value="<%=strPostID%>">
<input name="TopicID" type="hidden" value="<%=strTopicID%>">
<input name="ForumID" type="hidden" value="<%=strForumID%>">
<input name="submit" type="submit" value="删除">
</td>
</tr>
</form>
</table>
<%
end if
%>
<table width="100%" border="0" cellspacing="1" cellpadding="3" align="center" class="main">
<tr align="center" valign="middle" class="title">
<td colspan="2"><%=Site_Name%> // 编辑话题</td>
</tr>
<form action="editing.asp?Action=Edit" method="post" name="reply" id="reply" onSubmit="this.button.disabled = true;">
<tr valign="top" class="body">
<td width="250"><b>用户名:</b></td>
<td><%=pName%></td>
</tr><tr valign="top" class="body">
<td width="250"><b>帖子主题:</b></td>
<td><input name="Title" type="text" style="width: 400px; border: 1px solid black" value="<%=pTitle%>" maxlength="50" tabindex="1"></td>
</tr>
<tr valign="top" class="body">
<td width="250">
<b>你的话题:</b>
<br>
<br>
<table border="0" align="center" cellpadding="0" cellspacing="1" class="main" style="width: 210px;">
<tr valign="middle" class="title">
<td height="15" align="center" valign="middle">你的表情</td>
</tr>
<tr valign="top" class="body">
<td align="center">
<b>Click on a Smiley to insert it.</b>
<script language="Javascript" type="text/javascript">
function insertsmilie(smilieface)
{
document.reply.text.value+=smilieface;
document.reply.text.focus();
}
</script>
</td>
</tr>
<tr align="center" valign="middle" class="body">
<td height="25" align="left">
<%
'Smiley loop
set rsSmilies = server.createobject("adodb.recordset")
sqlSmilies = "SELECT TOP 15 * FROM Forum_Smilies;"
rsSmilies.open sqlSmilies, adoConn, CMDText
if not (rsSmilies.eof or rsSmilies.bof) then
SmileyCnt = rsSmilies.recordcount
SmileyData = rsSmilies.getrows()
else
SmileyCnt = 0
end if
tempCnt = 0
do until tempCnt = SmileyCnt
response.write("<a href=""javascript:insertsmilie('"& SmileyData(1, tempCnt) &" ')"" style='width: 65px; text-align: center; margin-bottom: 5px;'><img src='Images/Smilies/"& SmileyData(2, tempCnt) &"' border='0'></a>")
tempCnt = tempCnt + 1
if tempCnt mod 3 = 0 then response.write("<br>")
loop
%>
</td>
</tr>
<tr valign="top" class="body">
<td align="center"><a href="#" onclick="javascript:window.open('pop-smilies.asp', '', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=240,height=200');">[More Smilies]</a></td>
</tr>
</table>
</td>
<td><textarea name="text" style="width: 400px; height: 250px; border: 1px solid black;" tabindex="2"><%=pText%></textarea></td>
</tr>
<%
if Admin = true or Moderator = true then
%>
<tr class="body" valign="top">
<td>
<b>管理设置:</b>
</td>
<td>
<input name="Post_Type" type="radio" value="9" <%if strTopicStatus = 0 then response.write("checked")%> tabindex="3">Closed <input name="Post_Type" type="radio" value="1" <%if strTopicType = 1 then response.write("checked")%> tabindex="4">Standard <input name="Post_Type" type="radio" value="2"<%if strTopicType = 2 then response.write("checked")%> tabindex="5">Sticky <%if Admin = true then%><input name="Post_Type" type="radio" value="3" <%if strTopicType = 3 then response.write("checked")%> tabindex="6">Announcement<%end if%>
<br>
<br>
<%
set rsForums = server.createobject("adodb.recordset")
sqlForums = "SELECT Forum_ID, Forum_Name, Category_ID, Category_Title FROM Forum_Forums, Forum_Categories WHERE Forum_Category_ID = Category_ID AND Forum_Category_ID <> 10 ORDER BY Forum_Category_ID, Forum_ID"
rsForums.open sqlForums, adoConn, CMDText
if not (rsForums.eof or rsForums.bof) then
ForumCnt = rsForums.recordcount
ForumData = rsForums.getrows()
else
ForumCnt = 0
end if
rsForums.close
set rsForums = nothing
tempCnt = 0
tempCategory = ""
response.write("<select name='ForumID' style='width: 300px' tabindex='7'>")
do until tempCnt = ForumCnt
if tempCategory <> ForumData(2, tempCnt) then
tempCategory = ForumData(2, tempCnt)
response.write("<option value='C"& ForumData(2, tempCnt) &"'>"& ForumData(3, tempCnt) &"</option>")
end if
response.write("<option value='"& ForumData(0, tempCnt) &"'")
if strForumID = ForumData(0, tempCnt) then response.write(" selected")
response.write(">- - "& ForumData(1, tempCnt) &"</option>")
tempCnt = tempCnt + 1
loop
response.write("</select>")
%>
</td>
</tr>
<%
else
%>
</td>
</tr>
<input name="ForumID" type="hidden" value="<%=strForumID%>">
<%
end if
%>
<tr valign="top" class="body">
<td width="250"><b>帖子设置:</b></td>
<td>
<table width="200" border="0" cellspacing="1" cellpadding="2">
<tr>
<td width="20"><input name="bbcode" type="checkbox" value="1" checked tabindex="8"></td>
<td>Process BB Code</td>
</tr>
<tr>
<td width="20"><input type="checkbox" name="smilies" value="1" checked tabindex="9"></td>
<td>Include Smilies</td>
</tr>
<tr>
<td width="20"><input type="checkbox" name="signature" value="1" <%if pSignature = 1 then%> checked<%end if%> tabindex="10"></td>
<td>Include Signature</td>
</tr>
</table>
</td>
</tr>
<tr valign="top" class="body">
<td width="250"> </td>
<td>
<input name="UserName" type="hidden" value="<%=pName%>">
<input name="PostID" type="hidden" value="<%=strPostID%>">
<input name="TopicID" type="hidden" value="<%=strTopicID%>">
<input name="OldForumID" type="hidden" value="<%=strForumID%>">
<input name="reset" type="reset" id="reset" value="重置" style="width: 80px;" tabindex="12"> <input name="button" type="submit" id="submit" value="完成" style="width: 80px;" tabindex="11">
</td>
</tr>
</form>
</table>
<table border="0" cellspacing="1" cellpadding="2" align="center" class="main">
<tr valign="middle" class="title">
<td align="center" colspan="3"><%=Site_Name%> // 论坛说明</td>
</tr>
<tr valign="middle" class="body">
<td width="33%">
HTML:
<%
if Site_Allow_HTML = 1 then
response.write("<font color='#009900'><b>Enabled</b></font>")
else
response.write("<font color='#CC0000'><b>Disabled</b></font>")
end if
%>
</td>
<td width="33%">
BB Code:
<%
if Site_Allow_BB = 1 then
response.write("<font color='#009900'><b>Enabled</b></font>")
else
response.write("<font color='#CC0000'><b>Disabled</b></font>")
end if
%>
</td>
<td width="33%">
Image Code:
<%
if strImages = 1 then
response.write("<font color='#009900'><b>Enabled</b></font>")
else
response.write("<font color='#CC0000'><b>Disabled</b></font>")
end if
%>
</td>
</tr>
</table>
<%
end if
%>
<!--#include file="Includes/inc-footer.asp" -->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -