g_edit.asp

来自「此文件为一个电子同学录」· ASP 代码 · 共 150 行

ASP
150
字号
<!--#include file="conn.asp"-->
<!-- #include file="inc/const.asp" -->
<%
'=========================================================
' File: g_post.asp
 ' Date: 2006-04-06
' Script Written by Leibo
'=========================================================
' Copyright (C) 2002,2008 Mathren.com. All rights reserved.
' Web: http://www.hrbyydz.com
' Email: qa_90@hotmail.com
'=========================================================
dim canedit,postid
dim title,content,old_user

if not founduser then
  	errmsg=errmsg+"<br>"+"<li>您没有<a href=login.asp target=_blank>登录</a>。"
	founderr=true
end if
if request("id")="" then
	founderr=true
	Errmsg=Errmsg+"<br>"+"<li>请指定相关贴子。"
elseif not isInteger(request("id")) then
	founderr=true
	Errmsg=Errmsg+"<br>"+"<li>非法的贴子参数。"
else
	PostID=request("id")
end if
if founderr then
	call head()
	call head_var("错误信息",Request.ServerVariables("HTTP_REFERER"))
	call txl_error()
else
	stats="修改留言"
	call head()
	call head_var("班级留言","g_index.asp")
	call main()
	if founderr then call txl_error()
end if
call foot()

sub main()

sql="select g.title,g.content,g.postuser,u.usergroupID from gbook g,[user] u where g.postuserid=u.userid and g.postid="&postID
set rs=conn.execute(sql)
if rs.eof and rs.bof then
	Errmsg=Errmsg+"<br>"+"<li>没有找到相应的帖子。"
	Founderr=true
	exit sub
else	
	title=rs(0)
	content=rs(1)
	old_user=rs(2)
	if rs(2)=membername then
		if Cint(GroupSetting(31))=1 then
			Errmsg=Errmsg+"<br>"+"<li>您没有在本论坛编辑自己帖子的权限,请<a href=login.asp>登陆</a>或者同管理员联系。"
			founderr=true
			exit sub
			CanEdit=False
		else
			CanEdit=True
		end if
	else	
		if (master or supermaster) and Cint(GroupSetting(27))=0 then
			CanEdit=True
		else
			CanEdit=False
		end if
		if UserGroupID<3 and UserGroupID=rs("UserGroupID") then
			Errmsg=Errmsg+"<br>"+"<li>同等级用户不能修改。"
			Founderr=true
			exit sub
		elseif UserGroupID<3 and UserGroupID>rs("UserGroupID") then
			Errmsg=Errmsg+"<br>"+"<li>不能修改等级比您高的用户的帖子。"
			Founderr=true
			exit sub
		end if
		if not CanEdit then
			Errmsg=Errmsg+"<br>"+"<li>您没有足够的权限编辑本帖子,请和管理员联系。"
			Founderr=true
			exit sub
		end if
	end if
end if

set rs=nothing

if content<>"" then
	content=replace(content,"<br>",chr(13))
	content=replace(content,"&nbsp;","")
	content=content+chr(13)
end if
%>
<script src="inc/ubbcode.js"></script>
<table width="<%=txl_body(0)%>" cellpadding="0" cellspacing="0" align="center" style="border:1px <%=txl_body(9)%> solid; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 0px; border-left-width: 1px;">
<form action="g_SaveEdit.asp?id=<%=postid%>" method=POST onSubmit=submitonce(this) name=frmAnnounce>  
<tr> 
<td  bgcolor=<%=txl_body(10)%>><br>
<table cellpadding=3 cellspacing=1 align=center class=tableBorder1>
<tr>
<th height=25 align=left colspan=2> 修改留言</th>
</tr>
<tr>
<td width=20% class=tablebody2><b>用户名</b></td>
<td width=80% class=tablebody2><input name=postuser value=<%=htmlencode(old_user)%>>&nbsp;&nbsp;<font color=#ce0000><b>*</b></font><a href=register.asp>您没有注册?</a></td>
</tr>
<tr>
<td width=20% class=tablebody1><b>密&nbsp;&nbsp;码</b></td>
<td width=80% class=tablebody1><input name=password type=password value=<%=htmlencode(memberword)%>><font color=#ce0000>&nbsp;&nbsp;<b>*</b></font><a href=lostpass.asp>忘记密码?</a></td>
</tr>
<tr>
<td width=20% class=tablebody2><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=80% class=tablebody2><input name=subject size=60 maxlength=80 value=<%=htmlencode(title)%> >&nbsp;&nbsp;<font color=#ce0000><strong>*</strong></font>不得超过 25 个汉字或50个英文字符</td>	
</tr>
<tr>
<td width=20% valign=top class=tablebody1><b>当前心情</b><br><li>将放在帖子的前面</td>
<td width=80% class=tablebody1>
<%for i=0 to txl_PostFaceNum%>
<input type="radio" value="<%=txl_PostFace(i)%>" name="Expression" <%if i=0 then response.write "checked"%>><img src="<%=txl_info(8)&txl_PostFace(i)%>" >&nbsp;&nbsp;
<%if i>0 and ((i+1) mod 9=0) then response.write "<br>"%>
<%next%>
 </td>
</tr>
<tr>
<td width=20% valign=top class=tablebody1>
<b>内容</b><br>
<li>HTML标签: 
<li>UBB标签: 
<li>贴图标签: 
<li>多媒体标签:
<li>表情字符转换:
<li>上传图片:
<li>最多<BR><BR>
</td>
<td width=80% class=tablebody1>
<%if Cint(txl_set(18))=0 then%><!--#include file="inc/getubb.asp"--><%end if%>
<textarea class=smallarea cols=95 name=Content rows=12 wrap=VIRTUAL title="可以使用Ctrl+Enter直接提交贴子" class=FormClass onkeydown=ctlent()><%=server.htmlencode(content)%></textarea>
</td>
</tr>
<tr>
<td align=center class=tablebody2 height=30 colspan=2><input type=submit name=Submit value="发 表">

⌨️ 快捷键说明

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