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

📄 g_saveedit.asp

📁 此文件为一个电子同学录
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!-- #include file="inc/const.asp" -->
<!-- #include file="inc/ubbcode.asp" -->
<!-- #include file="inc/chkinput.asp" -->
<%
dim postid,title,content
dim postuser,expression


postuser=trim(checkStr(request("postuser")))
PassWord=trim(checkStr(request("password")))
IP=replace(Request.ServerVariables("REMOTE_ADDR"),"'","")
postID=Cstr(checkStr(Request("ID")))
Expression=checkStr(Request.Form("Expression"))
title=trim(checkStr(request("subject")))
content=trim(checkStr(request("content")))

if not founduser then
	ErrMsg=ErrMsg+"<Br>"+"<li>请登陆后进行修改。"
	foundErr=True
end if
if instr(Expression,"face")=0 then
	Expression="face1.gif"
end if
if chkpost=false then
	ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法,请不要从外部提交发言。"
   	FoundErr=True
end if
if postID="" then
	founderr=true
	Errmsg=Errmsg+"<br>"+"<li>请指定相关贴子。"
elseif not isInteger(postid) then
	founderr=true
	Errmsg=Errmsg+"<br>"+"<li>非法的贴子参数。"
end if
if postuser="" then
	ErrMsg=ErrMsg+"<Br>"+"<li>请输入姓名(长度不能大于20)"
   	foundErr=True
elseif Trim(PassWord)="" then
	ErrMsg=ErrMsg+"<Br>"+"<li>请输入密码(长度不能大于16)"
   	foundErr=True
end if
if request("content")="" then
	ErrMsg=ErrMsg+"<Br>"+"<li>内容不能为空"
   	foundErr=True
end if
if strLength(content)>Clng(txl_set(21)) then
	ErrMsg=ErrMsg+"<Br>"+"<li>发言内容不得大于" & CSTR(txl_set(21)) & "bytes"
   	foundErr=true
end if

stats="编辑留言成功"

if founderr then
	call head()
	call head_var("","")
	call txl_error()
else
	call head()
	call head_var("","")
	call main()
end if
call foot()

sub main()
dim caneditpost
caneditpost=false
sql="select g.postuser,g.addtime,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
	if rs("postuser")=membername then
		if Cint(GroupSetting(31))=1 then
			Errmsg=Errmsg+"<br>"+"<li>您没有在本论坛编辑自己留言的权限,请<a href=login.asp>登陆</a>或者同管理员联系。"
			founderr=true
			exit sub
			CanEditPost=False
		else
			CanEditPost=True
		end if
	else
		if (master or supermaster) and Cint(GroupSetting(27))=0 then
			CanEditPost=True
		else
			CanEditPost=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 CanEditPost then
			Errmsg=Errmsg+"<br>"+"<li>您没有足够的权限编辑本留言,请和管理员联系。"
			Founderr=true
			exit sub
		end if
	end if
end if

Set rs = Server.CreateObject("ADODB.Recordset")
sql="SELECT * FROM gbook where postuser='"&trim(postuser)&"' and postID="&postid
rs.Open sql,conn,1,3
if rs.eof and rs.bof then
	foundErr=True
	ErrMsg=ErrMsg+"<Br>"+"<li>您不是本留言的作者,无权修改!"
	rs.close:set rs=nothing
	exit sub
else
	rs("title") =replace(title,"''","'")
	rs("content") =replace(content,"''","'")
	rs("titleimg")=Expression
	rs.Update
	rs.close:set rs=nothing
%>
<meta http-equiv=refresh content="3;URL=g_index.asp">
<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;">  
<tr> 
<td  bgcolor=<%=txl_body(10)%>><br>
<table cellpadding=3 cellspacing=1 align=center class=tableborder1 style="width:75%">
<tr align=center>
<th width="100%">状态:<%=stats%></td>
</tr>
<tr>
<td width="100%" class=tablebody1>本页面将在3秒后自动返回您所修改的留言,<b>您可以选择以下操作:</b><br><ul>
<li><a href="index.asp">返回首页</a></li>
<li><a href="g_index.asp">您所修改的留言</a></li>
</ul></td>
</tr>
</table>
<br>
</td>
</tr>
</table>
<%
end if
end sub
%>

⌨️ 快捷键说明

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