b_SaveEdit.asp
上传用户:comthink
上传日期:2021-05-06
资源大小:1280k
文件大小:5k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

HTML/CSS

  1. <!--#include file="conn.asp"-->
  2. <!-- #include file="inc/const.asp" -->
  3. <!-- #include file="inc/ubbcode.asp" -->
  4. <!-- #include file="inc/chkinput.asp" -->
  5. <%
  6. dim postid,replyid,rootID,title,content,signflag,mailflag
  7. dim postuser,expression
  8. postuser=trim(checkStr(request("realname")))
  9. PassWord=trim(checkStr(request("password")))
  10. IP=replace(Request.ServerVariables("REMOTE_ADDR"),"'","")
  11. Expression=checkStr(Request.Form("Expression"))
  12. rootID=Cstr(checkStr(Request("ID")))
  13. postID=checkStr(request("replyID"))
  14. title=trim(checkStr(request("subject")))
  15. content=trim(checkStr(request("content")))
  16. signflag=trim(checkStr(request("signflag")))
  17. mailflag=trim(checkStr(request("Forum_Setting(2)")))
  18. if not founduser then
  19. ErrMsg=ErrMsg+"<Br>"+"<li>请登陆后进行修改。"
  20. foundErr=True
  21. end if
  22. if signflag="yes" then
  23. signflag=1
  24. else
  25. signflag=0
  26. end if
  27. if mailflag="yes" then
  28. mailflag=1
  29. else
  30. mailflag=0
  31. end if
  32. if instr(Expression,"face")=0 then
  33. Expression="face1.gif"
  34. end if
  35. if chkpost=false then
  36. ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法,请不要从外部提交发言。"
  37.     FoundErr=True
  38. end if
  39. if postID="" then
  40. founderr=true
  41. Errmsg=Errmsg+"<br>"+"<li>请指定相关贴子。"
  42. elseif not isInteger(postid) then
  43. founderr=true
  44. Errmsg=Errmsg+"<br>"+"<li>非法的贴子参数。"
  45. end if
  46. if rootID="" then
  47. founderr=true
  48. Errmsg=Errmsg+"<br>"+"<li>请指定相关贴子。"
  49. elseif not isInteger(rootID) then
  50. founderr=true
  51. Errmsg=Errmsg+"<br>"+"<li>非法的贴子参数。"
  52. end if
  53. if postuser="" then
  54. ErrMsg=ErrMsg+"<Br>"+"<li>请输入姓名(长度不能大于20)"
  55.     foundErr=True
  56. elseif Trim(PassWord)="" then
  57. ErrMsg=ErrMsg+"<Br>"+"<li>请输入密码(长度不能大于16)"
  58.     foundErr=True
  59. end if
  60. if request("content")="" then
  61. ErrMsg=ErrMsg+"<Br>"+"<li>内容不能为空"
  62.     foundErr=True
  63. end if
  64. if strLength(content)>Clng(txl_set(22)) then
  65. ErrMsg=ErrMsg+"<Br>"+"<li>发言内容不得大于" & CSTR(txl_set(22)) & "bytes"
  66.     foundErr=true
  67. end if
  68. stats="编辑帖子成功"
  69. if founderr then
  70. call head()
  71. call head_var("","")
  72. call txl_error()
  73. else
  74. call head()
  75. call head_var("","")
  76. call main()
  77. end if
  78. call foot()
  79. sub main()
  80. dim caneditpost
  81. caneditpost=false
  82. sql="select b.postuser,b.addtime,u.usergroupID from bbs b,[user] u where b.postuserid=u.userid and b.bbsID="&postID
  83. set rs=conn.execute(sql)
  84. if rs.eof and rs.bof then
  85. Errmsg=Errmsg+"<br>"+"<li>没有找到相应的帖子。"
  86. Founderr=true
  87. exit sub
  88. else
  89. if rs("postuser")=membername then
  90. if Cint(GroupSetting(13))=1 then
  91. Errmsg=Errmsg+"<br>"+"<li>您没有在本论坛编辑自己帖子的权限,请<a href=login.asp>登陆</a>或者同管理员联系。"
  92. founderr=true
  93. exit sub
  94. CanEditPost=False
  95. else
  96. CanEditPost=True
  97. end if
  98. else
  99. if (master or supermaster) and Cint(GroupSetting(28))=0 then
  100. CanEditPost=True
  101. else
  102. CanEditPost=False
  103. end if
  104. if UserGroupID<3 and UserGroupID=rs("UserGroupID") then
  105. Errmsg=Errmsg+"<br>"+"<li>同等级用户不能修改。"
  106. Founderr=true
  107. exit sub
  108. elseif UserGroupID<3 and UserGroupID>rs("UserGroupID") then
  109. Errmsg=Errmsg+"<br>"+"<li>不能修改等级比您高的用户的帖子。"
  110. Founderr=true
  111. exit sub
  112. end if
  113. if not CanEditPost then
  114. Errmsg=Errmsg+"<br>"+"<li>您没有足够的权限编辑本帖子,请和管理员联系。"
  115. Founderr=true
  116. exit sub
  117. end if
  118. end if
  119. end if
  120. Set rs = Server.CreateObject("ADODB.Recordset")
  121. sql="SELECT * FROM bbs where postuser='"&trim(postuser)&"' and bbsID="&postid
  122. rs.Open sql,conn,1,3
  123. if rs.eof and rs.bof then
  124. foundErr=True
  125. ErrMsg=ErrMsg+"<Br>"+"<li>您不是本帖子的作者,无权修改!"
  126. rs.close:set rs=nothing
  127. exit sub
  128. else
  129. if rs("rootid")=0 then
  130. conn.execute("update topic set title='"&title&"',LastTime=Now() where topicid="&rootid)
  131. end if
  132. rs("title") =replace(title,"''","'")
  133. rs("content") =replace(content,"''","'")
  134. rs("titleimg")=Expression
  135. rs("signflag")=signflag
  136. rs("emailflag")=mailflag
  137. rs.Update
  138. rs.close:set rs=nothing
  139. %>
  140. <meta http-equiv=refresh content="3;URL=b_show.asp?id=<%=rootid%>">
  141. <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;">  
  142. <tr> 
  143. <td  bgcolor=<%=txl_body(10)%>><br>
  144. <table cellpadding=3 cellspacing=1 align=center class=tableborder1 style="width:75%">
  145. <tr align=center>
  146. <th width="100%">状态:<%=stats%></td>
  147. </tr>
  148. <tr>
  149. <td width="100%" class=tablebody1>本页面将在3秒后自动返回您所修改的帖子,<b>您可以选择以下操作:</b><br><ul>
  150. <li><a href="index.asp">返回首页</a></li>
  151. <li><a href="b_index.asp">班级论坛</a></li>
  152. <li><a href="b_show.asp?id=<%=rootid%>">您所修改的帖子</a></li>
  153. </ul></td>
  154. </tr>
  155. </table>
  156. <br>
  157. </td>
  158. </tr>
  159. </table>
  160. <%
  161. end if
  162. end sub
  163. %>