⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 managepost.asp

📁 酷虎网同学录V1.0
💻 ASP
字号:
<!--#INCLUDE FILE="setup.asp" -->
<!--#include file="char.asp" -->
<!--#include file="checkuser.asp" -->
<!--#INCLUDE FILE="theme.asp" -->
<%
locat="校园论坛"
dim RootID

if membername="" then
  	errmsg=errmsg+"<br>"+"<li>您还没有<a href=login.asp>登录</a>。"
	call top(1,1)
	call error("Information",errmsg)
else
	act="管理主题帖子"
	select case request("Action")
	case "Lock"
		call top(2,1)
		call mantopic()
	case "Top"
		call top(2,1)
		call mantopic()
	case "Recommend"
		call top(2,1)
		call mantopic()
	case "DeleteTopic"
		call top(2,1)
		call deletetopic()
	case "DeleteReply"
		act="删除回复帖子"
		call top(2,1)
		call deletereply()
	case "Edit"
		act="编辑帖子"
		call top(2,1)
		call editform()
	case "Save"
		act="编辑帖子"
		call top(2,1)
		call savedit()
	end select

end if



sub savedit()

	BBSID=checkstr(request("BBSID"))

   	set rs=conn.execute("select username,parentid from bbs where BBSID="&BBSID)
	if rs.bof and rs.eof then
		ErrMsg=ErrMsg+"<br>"+"<li>指定的贴子不存在!</li>"
		call error("Exclamation",errmsg)
	else
		if not sysadmin and rs(0)<>membername then
			Errmsg=Errmsg+"<br>"+"<li>对不起,您无权对这个帖子进行编辑操作!"
			call error("Exclamation",errmsg)
		else
			if chkpost=false then
				ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法,请不要从外部提交数据。"
				call error("Critical",errmsg)
				exit sub
			end if

			Topic=Checkstr(trim(request("title")))

			if rs(1)=0 then
				if Topic="" then
					FoundErr=True
					ErrMsg=ErrMsg+"<Br>"+"<li>主题不应为空。"
				end if
			end if

			if strLength(topic)>100 then
				FoundErr=True
			   	ErrMsg=ErrMsg+"<Br>"+"<li>主题长度不能超过100个字符!"
			end if

			Body=Checkstr(rtrim(request.form("content")))

			if body="" then
				ErrMsg=ErrMsg+"<Br>"+"<li>没有填写帖子内容。"
			   	FoundErr=true
			elseif strLength(body)>(Maxboardsize*1024) then
			   	ErrMsg=ErrMsg+"<Br>"+"<li>帖子内容不得大于" & Maxboardsize & "KBytes"
			   	FoundErr=true
			end if

			if founderr then
				call error("Information",errmsg)
				exit sub
			end if


			mood=request.form("mood")&".gif"

			edittime=formatdatetime(now,2)&"&nbsp;"&formatdatetime(now,4)
			if  sysadmin then 
				char_changed = "[align=right][此留言已于"&edittime&"编辑过][/align]"
			else
				char_changed = "[align=right][此留言已被作者于"&edittime&"编辑过][/align]"
			end if

			Body=body+chr(13)+chr(10)+chr(13)+chr(10)+char_changed

			sql="update [bbs] set topic='"&topic&"',mood='"&mood&"',body='"&body&"' where bbsid="&clng(bbsid)
			conn.execute(sql)
			if rs(1)=0 then rootid=bbsid else rootid=rs(1)
			rURL="ShowThread.asp?RootID="&rootid
			rtitle="编辑帖子成功"
			rmsg="<FONT COLOR="&TableContentcolor&">本页面将在3秒后自动返回您所编辑的帖子页面,<b>您可以选择以下操作:</b><br><ul>"&_
					"<li><a href=ForumDisplay.asp><font color="&TableContentcolor&">返回校友论坛</font></a></li>"&_
					"<li><a href=ShowThread.asp?RootID="&rootid&"><font color="&TableContentcolor&">编辑的帖子</font></a></li>"&_
					"</ul>"
			redirect 3,rurl,rtitle,rmsg
		end if

	end if
	set rs=nothing

end sub


sub editform()

	if request("BBSID")="" then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>请指定要编辑的贴子。"
	elseif not isInteger(request("BBSID")) then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>非法的贴子参数。"
	else
		BBSID=request("BBSID")
	end if

	if founderr then
		call error("Exclamation",errmsg)
		exit sub
	end if

   	set rs=conn.execute("select parentid,topic,body,mood from bbs where BBSID="&BBSID)
	if rs.bof and rs.eof then
		ErrMsg=ErrMsg+"<br>"+"<li>指定的贴子不存在!</li>"
		call error("Exclamation",errmsg)
		exit sub
	end if

if request("Mode")="Advanced" then
	advmode=true
elseif request("Mode")="Typical" then
	advmode=false
else
	advmode=signmodeflag
end if

%>

<BR><BR>
<form action="ManagePost.asp" method="POST" onSubmit="submitonce(this)" name="frmgbk">
<input type=hidden name=Action value="Save">
<input type=hidden name=BBSID value="<%=bbsid%>">
<div align="center"><center>
<table bgColor="<%=Tablebordercolor%>" cellpadding=0 cellspacing=0 border=0 width=100% cellspacing="0">
    <tr>
      <td width="100%">
<table cellpadding=3 cellspacing=1 border=0 width=100%>
    <tr>
      <th width="100%" bgcolor="<%=Tabletitlecolor%>" colspan=2 align=left><IMG SRC="IMAGES/nav.gif" hspace=3><strong>编辑帖子</strong>&nbsp;<%if advmode=false then%><A HREF="?Action=Edit&Mode=Advanced&BBSID=<%=bbsid%>" title="当前为简洁模式,按此切换到高级发贴模式">[高级模式]</A><%else%><A HREF="?Action=Edit&Mode=Typical&BBSID=<%=bbsid%>" title="当前为高级模式,按此切换到简洁发贴模式">[简洁模式]</A><%end if%></th>
    </tr>
        <tr bgcolor="<%=TablebodyColor2%>">
          <td width="22%"><font color="<%=TableContentcolor%>"><b>作者</b>
	  </td>
		            <td width="78%">&nbsp;&nbsp;<%=htmlencode(membername)%></font>
	 </td>
        </tr>
        <tr bgcolor="<%=TablebodyColor2%>">
          <td width="22%"><font color="<%=TableContentcolor%>"><b>帖子标题</b>
              <SELECT name=font onchange=DoTitle(this.options[this.selectedIndex].value)>
              <OPTION selected value="">[话题]</OPTION> <OPTION value=[原创]>[原创]</OPTION> 
              <OPTION value=[转帖]>[转帖]</OPTION> <OPTION value=[灌水]>[灌水]</OPTION> 
              <OPTION value=[讨论]>[讨论]</OPTION> <OPTION value=[求助]>[求助]</OPTION> 
              <OPTION value=[推荐]>[推荐]</OPTION> <OPTION value=[公告]>[公告]</OPTION> 
              <OPTION value=[注意]>[注意]</OPTION> <OPTION value=[贴图]>[贴图]</OPTION>
              <OPTION value=[建议]>[建议]</OPTION> <OPTION value=[下载]>[下载]</OPTION>
              <OPTION value=[分享]>[分享]</OPTION></SELECT>
	  </td>
		            <td width="78%">&nbsp;&nbsp;<font color="<%=TableContentcolor%>"><input name="title" size=68 maxlength=100 class=FormClass value="<%=rs("topic")%>">&nbsp;&nbsp;<font color=red><%if rs(0)=0 then%><strong>*</strong><%end if%></font>不超过50个汉字</font>
	 </td>
        </tr>

        <tr bgcolor="<%=TablebodyColor2%>">
          <td width="22%" valign="middle"><font color="<%=TableContentcolor%>"><b>发贴心情</b></font></td>
          <td width="78%">
<table border=0 width=100%><tr><td>
			  <%for i=1 to 18%>
	<input type="radio" value="face<%=i%>" name="mood" <%if "face"&i&".gif"=rs("mood") then response.write "checked"%>><img src="mood/face<%=i%>.gif" WIDTH="15" HEIGHT="15">
<%if i=9 then response.write "<br>"
next%>
</td></tr></table>
 </td>
        </tr>

            <tr bgcolor="<%=tablebodycolor2%>">
              <td>&nbsp;<B>帖子内容</B><BR>&nbsp;<a href=javascript:checklength()>[检测帖子长度]</a><BR><br><li>HTML标签:<font color=brown>OFF</font><BR><li>UBB标签:<%if ubbflag=true then response.write "<font color=#003399>ON" else response.write "<font color=brown>OFF"%></font><BR><li>最大长度:<font color=brown><%=MaxBoardSize%>KB</font><BR><BR>
			  <a href="javascript:openScript('help.asp?about=ubb',670,500)"  style="cursor:help"><IMG SRC="IMAGES/help.gif" WIDTH="42" HEIGHT="17" BORDER=0 ALT="查看UBB代码使用说明"></a>
              </td>
              <td><table border=0><%if advmode=true then%><!--#INCLUDE FILE="ubbtools.asp" --><%end if%><tr><td>&nbsp;&nbsp;<textarea onkeydown=ctlent() name="content" rows="12" cols="68" title="可以使用Ctrl+Enter直接提交帖子"  wrap="soft" ><%=rs("body")%></textarea></td><td>&nbsp;<font color=red>*</font></td></tr></table></td></tr>

<tr bgcolor="<%=TablebodyColor1%>">
                <td valign=middle colspan=2 align=center><font color="<%=TableContentcolor%>">
                <input type=Submit value="修 改" name=Sbmt> &nbsp; &nbsp;
<input type="reset" name="reset" value="清 除">
                </td></tr>
      </table>
      </td>
    </tr>
  </table>
  </center></div>
</form>
<script language="javascript">
function checklength(theform) {
var ly=frmgbk.content.value;
var strlen=strlength(ly);
alert("您的帖子长度为 "+strlen+" 字符.");

}</script>




<%
	set rs=nothing

end sub

sub saveedit()




end sub

sub deleteReply()

	if request("BBSID")="" then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>请指定要删除的贴子。"
	elseif not isInteger(request("BBSID")) then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>非法的贴子参数。"
	else
		BBSID=request("BBSID")
	end if

	if founderr then
		call error("Exclamation",errmsg)
		exit sub
	end if

   	set rs=conn.execute("select username,parentid from bbs where BBSID="&BBSID)
	if rs.bof and rs.eof then
		ErrMsg=ErrMsg+"<br>"+"<li>指定的贴子不存在!</li>"
		call error("Exclamation",errmsg)
	elseif rs(1)=0 then
		ErrMsg=ErrMsg+"<br>"+"<li>不能对主题贴子执行该操作!</li>"
		call error("Exclamation",errmsg)
	else
		if not sysadmin and rs(0)<>membername then
			Errmsg=Errmsg+"<br>"+"<li>对不起,您无权对这个帖子进行管理操作!"
			call error("Exclamation",errmsg)
		else
			sql="delete from bbs where bbsid="&BBSID
			conn.execute(sql)

			stitle="删除帖子"
			smsg="你已经成功的删除了所选帖子!"
			call success(stitle,smsg)
		end if

	end if
	set rs=nothing
end sub

sub deletetopic()
if chktopic=false then exit sub
if not sysadmin then
	Errmsg=Errmsg+"<br>"+"<li>对不起,你没有操作权限!"
	call error("Exclamation",errmsg)
else

sql="delete from bbs where bbsid="&RootID&" or parentid="&RootID
conn.execute(sql)

stitle="删除主题帖子"
smsg="你已经成功的删除了所选主题!"
call success(stitle,smsg)

end if
end sub


sub mantopic()
if chktopic=false then exit sub
if not sysadmin then
	Errmsg=Errmsg+"<br>"+"<li>对不起,你没有操作权限!"
	call error("Exclamation",errmsg)
else

if request("Action")="Top" then
	sql="update bbs set istop=not istop where parentid=0 and bbsid="&rootid
elseif request("Action")="Lock" then
	sql="update bbs set locked=not locked where parentid=0 and bbsid="&rootid
elseif request("Action")="Recommend" then
	set rs=conn.execute("select topic from bbs where parentid=0 and bbsid="&rootid)
	topic=rs(0)
	if right(topic,1)=chr(13) then
		topic=left(topic,len(topic)-1)
	else
		topic=topic+chr(13)
	end if
	sql="update bbs set topic='"&topic&"' where parentid=0 and bbsid="&rootid
end if
conn.execute(sql)

rURL="ShowThread.asp?RootID="&RootID
rtitle="管理帖子成功"
rmsg="<FONT COLOR="&TableContentcolor&">本页面将在3秒后自动返回您所管理的主题帖子,<b>您可以选择以下操作:</b><br><ul>"&_
		"<li><a href=ForumDisplay.asp><font color="&TableContentcolor&">返回校友论坛</font></a></li>"&_
		"<li><a href=ShowThread.asp?RootID="&RootID&"><font color="&TableContentcolor&">主题帖子</font></a></li>"&_
		"</ul>"
redirect 3,rurl,rtitle,rmsg

end if
end sub

function chktopic()

	if request("RootID")="" then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>请指定要管理的贴子。"
	elseif not isInteger(request("RootID")) then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>非法的贴子参数。"
	else
		RootID=request("RootID")
	end if

	if founderr then
		call error("Exclamation",errmsg)
		chktopic=false
		exit function
	end if

   	set rs=conn.execute("select locked from bbs where BBSID="&rootID&" and parentid=0")
	if rs.bof and rs.eof then
		foundErr = true
		ErrMsg=ErrMsg+"<br>"+"<li>指定的贴子不存在</li>"
	end if
	set rs=nothing

	chktopic=not founderr
	
	if founderr then
		call error("Exclamation",errmsg)
	end if

end function
%>

<%call footer()%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -