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

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