b_SaveEdit.asp
资源名称:txl.zip [点击查看]
上传用户:comthink
上传日期:2021-05-06
资源大小:1280k
文件大小:5k
源码类别:
WEB源码(ASP,PHP,...)
开发平台:
HTML/CSS
- <!--#include file="conn.asp"-->
- <!-- #include file="inc/const.asp" -->
- <!-- #include file="inc/ubbcode.asp" -->
- <!-- #include file="inc/chkinput.asp" -->
- <%
- dim postid,replyid,rootID,title,content,signflag,mailflag
- dim postuser,expression
- postuser=trim(checkStr(request("realname")))
- PassWord=trim(checkStr(request("password")))
- IP=replace(Request.ServerVariables("REMOTE_ADDR"),"'","")
- Expression=checkStr(Request.Form("Expression"))
- rootID=Cstr(checkStr(Request("ID")))
- postID=checkStr(request("replyID"))
- title=trim(checkStr(request("subject")))
- content=trim(checkStr(request("content")))
- signflag=trim(checkStr(request("signflag")))
- mailflag=trim(checkStr(request("Forum_Setting(2)")))
- if not founduser then
- ErrMsg=ErrMsg+"<Br>"+"<li>请登陆后进行修改。"
- foundErr=True
- end if
- if signflag="yes" then
- signflag=1
- else
- signflag=0
- end if
- if mailflag="yes" then
- mailflag=1
- else
- mailflag=0
- 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 rootID="" then
- founderr=true
- Errmsg=Errmsg+"<br>"+"<li>请指定相关贴子。"
- elseif not isInteger(rootID) 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(22)) then
- ErrMsg=ErrMsg+"<Br>"+"<li>发言内容不得大于" & CSTR(txl_set(22)) & "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 b.postuser,b.addtime,u.usergroupID from bbs b,[user] u where b.postuserid=u.userid and b.bbsID="&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(13))=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(28))=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 bbs where postuser='"&trim(postuser)&"' and bbsID="&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
- if rs("rootid")=0 then
- conn.execute("update topic set title='"&title&"',LastTime=Now() where topicid="&rootid)
- end if
- rs("title") =replace(title,"''","'")
- rs("content") =replace(content,"''","'")
- rs("titleimg")=Expression
- rs("signflag")=signflag
- rs("emailflag")=mailflag
- rs.Update
- rs.close:set rs=nothing
- %>
- <meta http-equiv=refresh content="3;URL=b_show.asp?id=<%=rootid%>">
- <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="b_index.asp">班级论坛</a></li>
- <li><a href="b_show.asp?id=<%=rootid%>">您所修改的帖子</a></li>
- </ul></td>
- </tr>
- </table>
- <br>
- </td>
- </tr>
- </table>
- <%
- end if
- end sub
- %>
English
