Save.Asp
上传用户:btntkt
上传日期:2021-04-16
资源大小:5296k
文件大小:12k
源码类别:

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

开发平台:

DOS

  1. <!--#include file="Inc/SysConfig.Asp"-->
  2. <!--#include file="Inc/Md5.Asp"-->
  3. <%
  4. Dim Action,Caption,Content,Face,Page,TmpUbbString,LowerCase,TemUrl
  5. If Not YxBBs.Founduser then YxBBs.Error("您还没有注册或者登陆!")
  6. IF (Session(YxBBs.CacheName&"SayTime")+Int(YxBBs.BBSSetting(30))/86400)>Now() Then YxBBs.Error("本论坛为了防止灌水,限制了同一人发帖的时间间隔为 <Font color=red>"& YxBBs.BBSSetting(30)&"</Font> 秒!")
  7. YxBBs.Fun.CheckMake
  8. YxBBs.CheckBoard()
  9. TemUrl=Replace(Request.Form("url"),"'","''")
  10. if TemUrl="" then TemUrl=Request.ServerVariables("HTTP_REFERER")
  11. Face=YxBBs.CheckNum(Request.form("face"))
  12. Caption=YxBBs.Fun.GetStr("caption")
  13. If instr(LCase(TemUrl),"show.asp")>0 then
  14. Content=YxBBs.Fun.htmlcode(YxBBs.Fun.checkbad(YxBBs.Fun.GetStr("content")))
  15. else
  16. Content=YxBBs.Fun.checkbad(YxBBs.Fun.GetStr("content"))
  17. end if
  18. If Caption="" Or Content="" then YxBBs.Error("主题或内容没有填写!")
  19. Caption=Jncode(Caption)
  20. Content=Jncode(Content)
  21. Function Jncode(Istr)
  22. Dim japArr,ArrNum
  23. japArr=Array("ゴ","ガ","ギ","グ","ゲ","ザ","ジ","ズ","ヅ","デ","ド","ポ","ベ","プ","ビ","パ","ヴ","ボ","ペ","ブ","ピ","バ","ヂ","ダ","ゾ","ゼ")
  24. For ArrNum=0 to Ubound(japArr)
  25. Istr=Replace(Istr,japArr(ArrNum),"&#"&AscW(japArr(ArrNum))&";")
  26. Next
  27. Jncode=Istr
  28. End Function
  29. IF Len(Caption)>YxBBs.BoardSetting(2) Then YxBBs.Error("帖子主题字符数超出论坛限制!")
  30. IF Len(Content)>int(YxBBs.BoardSetting(3)) or Len(Content)<int(YxBBs.BoardSetting(11)) Then YxBBs.Error("帖子字符应在 <b><font color=red>"&YxBBs.BoardSetting(11)&"</font> 到 <font color=red>"&YxBBs.BoardSetting(3)&"</font></b> 个字符之间")
  31. IF Session("CheckCode")<>Request.form("CheckCode") And Cint(YxBBs.BoardSetting(0))=1 then YxBBs.Error("发帖验证码错误!")
  32. YxBBs.Head("")
  33. Page=YxBBs.CheckNum(Request.QueryString("page"))
  34. Action=lcase(Request.QueryString("action"))
  35. IF Action="reply" Then
  36.   Reply()
  37. ElseIf Action="edit" Then
  38. Edit()
  39. Else
  40. Say()
  41. End if
  42. If Cint(YxBBs.BoardSetting(0))=1 then Session("CheckCode")=""
  43. Content="<div style='margin:15;line-height: 150%'>"&Content&"</div>"
  44. Call YxBBs.ShowTable(Caption,Content)
  45. Session(YxBBs.CacheName & "SayTime")=Now()
  46. YxBBs.Footer()
  47. Set YxBBs=Nothing
  48. Function CheckUploadType(byval Str)
  49. Dim pos
  50. Str=split(Str,"[UPLOAD=")
  51. If ubound(Str)>=1 then
  52. pos=instr(str(1),"[/UPLOAD]")
  53. If pos=0 then exit function
  54. CheckUploadType=left(str(1),3)
  55. End if
  56. End function
  57. Sub Say()
  58. Dim Temp,I,ISvote,TitleType,VoteType,VoteAutoValue,Votes,VoteNum,Outtime,UploadType,TopicLastReply,BoardLastReply,MaxID
  59. If Cint(YxBBs.ClassSetting(3))=0 Then YxBBs.Error("您没有发表主题的权限!")
  60. TmpUbbString=YxBBs.Fun.UbbString(Content)
  61. IsVote=false
  62. If instr(","&Join(Split(YxBBs.BoardSetting(1),"|"),",")&",",","&CheckUploadType(Content)&",")>0 then
  63. UploadType=CheckUploadType(Content)
  64. Else
  65. UploadType=""
  66. End if
  67. TitleType=YxBBs.CheckNum(request.Form("topicximoo"))
  68. VoteType=YxBBs.CheckNum(Request.Form("VoteType"))
  69. VoteAutoValue=YxBBs.CheckNum(Request.Form("AutoValue"))
  70. If Int(TitleType)<>0 Then
  71. If Int(YxBBs.MyCoin)<Int(YxBBs.BBSSetting(13)) Then YxBBs.Error("您的金钱不足于 <font color=#FF0000>"&Int(YxBBs.BBSSetting(13))&"</font> 啦!不能使用醒目标题!")
  72. YxBBs.Execute("Update [YX_user] Set Coin=Coin-"&Int(YxBBs.BBSSetting(13))&" WHERE Name='"&YxBBs.MyName&"'")
  73. End If
  74. If VoteType<>2 Then VoteType=1
  75. For i=1 to VoteAutoValue
  76. Temp=Left(YxBBs.Fun.Checkbad(Trim(YxBBs.Fun.GetStr("Votes"&I))),250)
  77. IF not Temp="" Then
  78. votes=Votes&"|"&Temp
  79. VoteNum=VoteNum&"|0"
  80. End If
  81. Next
  82. Outtime=cDate(YxBBs.NowBbsTime)+int(Request.form("OutTime"))
  83. If Votes<>"" Then
  84. IsVote=True
  85. '投票权限
  86. If Cint(YxBBs.ClassSetting(7))=0 Then YxBBs.Error("您没有发表投票的权限!")
  87. End If
  88. If Session(YxBBs.CacheName&"SayContent")=Md5(Caption&Content) Then YxBBs.Error("您的帖子已经发表成功,请不要重复提交!")
  89. '插入主题表
  90. TopicLastReply=YxBBs.Myname&"|"&YxBBs.Fun.StrLeft(YxBBs.Fun.FixReply(Content),40)
  91. YxBBs.Execute("Insert into [YX_Topic](Caption,Name,Face,IsVote,AddTime,LastTime,Lastreply,UploadType,BoardID,SqlTableID,TitleType)Values('"&Caption&"','"&YxBBs.Myname&"',"&Face&","&IsVote&",'"&YxBBs.NowBbsTime&"','"&YxBBs.NowBbsTime&"','"&TopicLastReply&"','"&UploadType&"',"&YxBBs.BoardID&","&YxBBs.TB&","&TitleType&")")
  92. '得到新发表主题的ID
  93. MaxID=YxBBs.Execute("select Max(TopicID) from [YX_Topic]")(0)
  94. '插入投票
  95. IF IsVote Then YxBBs.Execute("insert into[YX_TopicVote](TopicID,Vote,VoteNum,VoteType,OutTime)values("&MaxID&",'"&votes&"','"&VoteNum&"',"&votetype&",'"&Outtime&"')")
  96. '插入帖子
  97. YxBBs.Execute("Insert into [YX_bbs"&YxBBs.TB&"](TopicID,Caption,name,Content,AddTime,LastTime,BoardID,UbbString,IP)VALUES("&MaxID&",'"&Caption&"','"&YxBBs.MyName&"','"&Content&"','"&YxBBs.NowBbsTime&"','"&YxBBs.NowBbsTime&"',"&YxBBs.BoardID&",'"&TmpUbbString&"','"&YxBBs.MyIP&"')")
  98. '更新用户信息
  99. Dim UG
  100. Set UG = YxBBs.Execute("Select Top 1 GradeNum,GradeName,GradePic,UserMinPostNum from YX_UserGrade Where ClassID="&YxBBs.ClassID&" And UserMinPostNum<="&YxBBs.MyEssayNum&" Order By UserMinPostNum Desc")
  101. If Not UG.Eof Then
  102. YxBBs.Execute("Update [YX_User] Set Coin=Coin+"&YxBBs.BBSSetting(37)&",EssayNum=EssayNum+1,GradeNum="&UG(0)&" Where ID="&YxBBs.MyID)
  103. Else
  104. YxBBs.Execute("Update [YX_user] set Coin=Coin+"& YxBBs.BBSSetting(37)&",EssayNum=EssayNum+1 WHERE ID="&YxBBs.MyID)
  105. End If
  106. UG.Close
  107. Set UG=nothing
  108. '更新版块
  109. BoardLastReply=YxBBs.MyName&"|"&YxBBs.Fun.StrLeft(Caption,20)&"|"&YxBBs.NowBbsTime&"|"&Face&"|"&MaxID&"|"&YxBBs.BoardID&"|"&YxBBs.TB
  110. YxBBs.Execute("Update [YX_Board] set TopicNum=TopicNum+1,TodayNum=TodayNum+1,EssayNum=EssayNum+1,LastReply='"&BoardLastReply&"' where BoardID="&YxBBs.BoardID&" And Depth>0")
  111. '更新上级版块
  112. If YxBBs.BoardDepth>1 Then
  113. YxBBs.Execute("Update [YX_Board] set TopicNum=TopicNum+1,TodayNum=TodayNum+1,EssayNum=EssayNum+1,LastReply='"&BoardLastReply&"' where BoardID In ("&YxBBs.BoardParentStr&") And Depth>0")
  114. End If
  115. '更新系统
  116. YxBBs.Execute("Update [YX_config] set Topicnum=Topicnum+1,allEssayNum=AllEssayNum+1,TodayNum=TodayNum+1")
  117. UpdateCache()
  118. Session(YxBBs.CacheName&"SayContent")=Md5(Caption&Content)
  119. Caption="发帖成功"
  120. Content="<meta http-equiv=refresh content=3;url=Show.Asp?ID="&MaxId&"><b>本页面将在3秒后自动返回您发布的帖子!您可以选择以下操作:</b><br><ul><li><a href=Default.Asp>返回首页</a><li></li><a href=list.Asp?BoardID="&YxBBs.BoardID&">"&YxBBs.Boardname&"</a></li><li><a href=Show.Asp?ID="&MaxId&">回到你发布的帖</a></li></ul>"
  121. End Sub
  122. Sub Reply()
  123. Dim Rs,ID,TopicUserName,TopicLastReply,BoardLastReply,Temp,Quote,QuoteName,Coins
  124. ID=YxBBs.Checknum(Request.QueryString("Id"))
  125. Quote=YxBBs.Fun.GetStr("Quote")
  126. If Trim(Quote)<>"" Then Content=YxBBs.Fun.GetStr("QuoteName") & Quote & "[/quote]" & Content
  127. If Id=0 or YxBBs.BoardID=0 Then YxBBs.Error("错误的地址栏参数,请不要手动去更改地址栏参数!")
  128. TmpUbbString=YxBBs.Fun.UbbString(content)
  129. Set Rs=YxBBs.Execute("Select Name,IsLock,SqlTableID,BoardID From [YX_Topic] where TopicID="&ID&" And (BoardID="&YxBBs.BoardID&" Or TopType=4 or TopType=5) And SqlTableID="&YxBBs.TB&" And IsDel=False")
  130. IF Rs.Eof Then YxBBs.Error("该帖子不存在或已经删除")
  131. IF YxBBs.MyName=Rs(0) Then
  132. IF Rs(1) Then YxBBs.Error("该帖子已经被锁定!")
  133. End If
  134. '回复权限
  135. If Rs(0)=YxBBs.MyName Then
  136. If Cint(YxBBs.ClassSetting(4))=0 Then YxBBs.Error("您没有回复自己帖子的权限!")
  137. Else
  138. If Cint(YxBBs.ClassSetting(5))=0 Then YxBBs.Error("您没有回复别人帖子的权限!")
  139. End If
  140. TopicUserName=Rs(0)
  141. YxBBs.TB=Rs(2)
  142. YxBBs.BoardID=Rs(3)
  143. Set RS=Nothing
  144. If Session(YxBBs.CacheName&"SayContent")=Md5(Caption&Content) Then YxBBs.Error("您的回复发表成功,请不要重复提交!")
  145. '插入帖子
  146. YxBBs.Execute("insert into [YX_bbs"&YxBBs.TB&"](ReplyTopicID,name,Caption,Content,AddTime,LastTime,Boardid,UbbString,ip)VALUES("&ID&",'"&YxBBs.MyName&"','"&Caption&"','"&Content&"','"&YxBBs.NowBbsTime&"','"&YxBBs.NowBbsTime&"',"&YxBBs.BoardID&",'"&TmpUbbString&"','"&YxBBs.MyIp&"')")
  147. '更新主题帖子
  148. YxBBs.Execute("Update [YX_bbs"&YxBBs.TB&"] Set LastTime='"&YxBBs.NowBbsTime&"' where TopicId="&ID&"")
  149. '更新主题
  150. TopicLastReply=""&YxBBs.MyName&"|"&YxBBs.Fun.StrLeft(YxBBs.Fun.FixReply(Content),40)
  151. YxBBs.Execute("Update [YX_Topic] set ReplyNum=ReplyNum+1,LastTime='"&YxBBs.NowBbsTime&"',LastReply='"&TopicLastReply&"' where TopicId="&ID&"")
  152. '更新版块
  153. BoardLastReply=""&YxBBs.MyName&"|"&YxBBs.Fun.StrLeft(Caption,20)&"|"&YxBBs.NowBbsTime&"|"&Face&"|"&ID&"|"&YxBBs.BoardID&"|"&YxBBs.TB
  154. YxBBs.Execute("Update [YX_Board] set lastReply='"&BoardLastReply&"',TodayNum=TodayNum+1,EssayNum=EssayNum+1 where BoardID="&YxBBs.BoardID&" and Depth<>0")
  155. If YxBBs.BoardDepth>1 Then
  156. YxBBs.Execute("Update [YX_Board] set TopicNum=TopicNum+1,TodayNum=TodayNum+1,EssayNum=EssayNum+1,LastReply='"&BoardLastReply&"' where BoardID In ("&YxBBs.BoardParentStr&") And Depth>0")
  157. End If
  158. '更新用户
  159. If Len(Content)<10 Then Coins=0 Else 
  160. YxBBs.Execute("Update [YX_user] set Coin=Coin+"&YxBBs.BBSSetting(38)&",EssayNum=EssayNum+1 WHERE Name='"&YxBBs.Myname&"'")
  161. '更新楼主
  162. If Lcase(YxBBs.MyName)<>Lcase(TopicUserName) Then
  163. YxBBs.Execute("Update [YX_user] set Coin=Coin+"&YxBBs.BBSSetting(38)&" WHERE Name='"&TopicUserName&"'")
  164. End If
  165. '更新系统
  166. YxBBs.Execute("Update [YX_Config] set TodayNum=TodayNum+1,AllEssayNum=AllEssayNum+1")
  167. UpdateCache()
  168. Session(YxBBs.CacheName&"SayContent")=Md5(Caption&Content)
  169. Caption="回复成功"
  170. Content="<meta http-equiv=refresh content=3;url=Show.Asp?id="&ID&"&page="&page&"><b>本页面将在3秒后自动返回您回复帖子页面!您可以选择以下操作:</b><br><ul><li><a href=Default.Asp>返回首页</a><li></li><a href=list.Asp?BoardID="&YxBBs.BoardID&">"&YxBBs.Boardname&"</a></li><li><a href=Show.Asp?id="&ID&"&page="&page&">回到你回复的帖子</a></li></ul>"
  171. End Sub
  172. Sub Edit()
  173. Dim Rs,ID,BbsID,IsTopic,TopicID,TitleType,OldTitleType,EditChalk
  174. EditChalk=YxBBs.Fun.GetStr("EditChalk")
  175. ID=YxBBs.CheckNum(Request.QueryString("ID"))
  176. BbsID=YxBBs.CheckNum(Request.QueryString("BbsID"))
  177. If BbsID=0 Or ID=0 Then YxBBs.Error("请不要手动去更改地址栏参数!")
  178. IsTopic=False
  179. If EditChalk<>"No" Then
  180. Content=""&Content&vbcrlf&vbcrlf&vbcrlf&"<p align=right><font color=#0080FF>「该帖子被 "&YxBBs.MyName&" 在 "&YxBBs.NowBbsTime&" 编辑过」</font></p>"
  181. End If
  182. TmpUbbString=YxBBs.Fun.UbbString(content)
  183. Set Rs=YxBBs.Execute("select Name,TopicID,ReplyTopicID from [YX_bbs"&YxBBs.TB&"] where BbsID="&BbsID&"")
  184. If Not Rs.eof  Then
  185. If Lcase(YxBBs.MyName)<>Lcase(rs("name")) Then
  186. If Cint(YxBBs.ClassSetting(18))=0 Then YxBBs.Error("您没有编辑别人帖子的权限!")
  187. Else
  188. '编辑自己帖子的权限
  189. If Cint(YxBBs.ClassSetting(9))=0 Then YxBBs.Error("您没有编辑自己帖子的权限!")
  190. End If
  191. IF Rs("ReplyTopicID")=0 Then
  192. TopicID=Rs("TopicID")
  193. IsTopic=True
  194. End IF
  195. Rs.Close
  196. Else
  197. YxBBs.Error("该帖子不存在或已经删除!")
  198. End if
  199. YxBBs.Execute("Update [YX_bbs"&YxBBs.TB&"] set Caption='"&Caption&"',Content='"&Content&"',LastTime='"&YxBBs.NowBbsTime&"',UbbString='"&TmpUbbString&"' where BbsID="&BbsID&"")
  200. If IsTopic then
  201. TitleType=YxBBs.CheckNum(Request.Form("topicximoo"))
  202. OldTitleType=YxBBs.CheckNum(Request.Form("OldTitleType"))
  203. If Int(TitleType)<>0 Then
  204.  If Int(YxBBs.MyCoin)<Int(YxBBs.BBSSetting(13)) Then 
  205.  YxBBs.Error("您的金钱不足于 <font color=#FF0000>"&Int(YxBBs.BBSSetting(13))&"</font> 啦!不能使用醒目标题!")
  206.  else
  207.  YxBBs.Execute("Update [YX_User] Set Coin=Coin-"&Int(YxBBs.BBSSetting(13))&" WHERE Name='"&YxBBs.MyName&"'")
  208.  End If
  209.                 else
  210.                 TitleType=OldTitleType
  211. End If
  212. YxBBs.Execute("Update [YX_Topic] set Caption='"&Caption&"',Face="&Face&",LastTime='"&YxBBs.NowBbsTime&"',TitleType="&TitleType&" where TopicID="&TopicID&"")
  213. End if
  214. Caption="修改成功"
  215. Content="<meta http-equiv=refresh content=3;url=Show.Asp?id="&ID&"&page="&page&">本页面将在3秒后自动返回您编辑的帖子!<b>您可以选择以下操作:</b><br><ul><li><a href=Default.Asp>返回首页</a><li></li><a href=list.Asp?BoardID="&YxBBs.BoardID&">"&YxBBs.Boardname&"</a></li><li><a href=Show.Asp?id="&ID&"&page="&page&">回到你编辑的帖子</a></li></ul>"
  216. End Sub
  217. Sub UpdateCache()
  218. Dim Temp
  219. Temp=YxBBs.TodayNum+1
  220. If Int(Temp)>Int(YxBBs.MaxEssayNum) Then
  221. YxBBs.Execute("Update [YX_Config] set MaxEssayNum="&Temp&"")
  222. End If
  223. Session(YxBBs.CacheName & "MyInfo") = Empty
  224. '更新系统
  225. Cache.Name="Config"
  226. Cache.clean()
  227. '更新版块
  228. Cache.Name="BoardInfo"
  229. Cache.clean()
  230. End Sub
  231. %>