PageRenderTime 23ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/Wap/Plus/Comment.asp

https://github.com/joechen2010/health
ASP | 240 lines | 222 code | 12 blank | 6 comment | 2 complexity | e83a8de9df4f9f540f65c1a896778e63 MD5 | raw file
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
  2. <!--#include file="../Conn.asp"-->
  3. <!--#include file="../KS_Cls/Kesion.CommonCls.asp"-->
  4. <!--#include file="../KS_Cls/Kesion.Label.CommonCls.asp"-->
  5. <%Response.ContentType = "text/vnd.wap.wml; charset=utf-8"%><?xml version="1.0" encoding="utf-8"?>
  6. <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
  7. <wml>
  8. <head>
  9. <meta http-equiv="Cache-Control" content="no-Cache"/>
  10. <meta http-equiv="Cache-Control" content="max-age=0"/>
  11. </head>
  12. <card title="所有评论">
  13. <p>
  14. <%
  15. Dim KS:Set KS=New PublicCls
  16. Call KSUser.UserLoginChecked()
  17. Dim ChannelID,InfoID,DomainStr
  18. ChannelID=KS.Chkclng(KS.S("ChannelID"))
  19. InfoID=KS.ChkClng(KS.S("InfoID"))
  20. DomainStr=KS.GetDomain
  21. Select Case KS.S("Action")
  22. Case "write"
  23. Call GetWriteComment()
  24. Case "writesave"
  25. Call WriteSave()
  26. Case "support"
  27. Call Support()'投票
  28. Case Else
  29. Call CommentMain()
  30. End Select
  31. %>
  32. <a href="../Show.asp?ID=<%=InfoID%>&amp;ChannelID=<%=ChannelID%>&amp;<%=KS.WapValue%>">返回<%=KS.C_S(ChannelID,3)%></a><br/>
  33. <%
  34. Response.write " <a href=""" & KS.GetGoBackIndex & """>返回首页</a><br/>"
  35. Call CloseConn
  36. Set KS=Nothing
  37. Set KSUser=Nothing
  38. %>
  39. </p>
  40. </card>
  41. </wml>
  42. <%
  43. Sub CommentMain
  44. MaxPerPage=5 '每页显示评论条数
  45. If KS.S("page") <> "" Then
  46. CurrentPage = KS.ChkClng(KS.S("page"))
  47. Else
  48. CurrentPage = 1
  49. End If
  50. Set RS=Server.CreateObject("ADODB.RECORDSET")
  51. RS.Open "Select ID,Title From " & KS.C_S(ChannelID,2) & " Where ID="&InfoID&"",Conn,1,1
  52. If Not RS.Eof Then
  53. TitleLinkStr="<a href="""&DomainStr&"Show.asp?ID="&InfoID&"&amp;ChannelID="&ChannelID&"&amp;"&KS.WapValue&""">"&RS(1)&"</a>"
  54. Else
  55. Exit Sub
  56. End If
  57. RS.Close
  58. RS.Open "Select * from KS_Comment where ChannelID="&ChannelID&" And InfoID="&InfoID&" order by AddDate desc",Conn,1,1
  59. If RS.EOF Then
  60. Response.Write "没有找到相关评论。<br/>" &vbcrlf
  61. Else
  62. Response.Write "["&TitleLinkStr&"]的评论,共:"&RS.RecordCount&"条评论<br/>-----------<br/>" &vbcrlf
  63. TotalPut = RS.RecordCount
  64. If CurrentPage < 1 Then CurrentPage = 1
  65. If (CurrentPage - 1) * MaxPerPage > totalPut Then
  66. If (totalPut Mod MaxPerPage) = 0 Then
  67. CurrentPage = totalPut \ MaxPerPage
  68. Else
  69. CurrentPage = totalPut \ MaxPerPage + 1
  70. End If
  71. End If
  72. If CurrentPage >1 and (CurrentPage - 1) * MaxPerPage < totalPut Then
  73. RS.Move (CurrentPage - 1) * MaxPerPage
  74. Else
  75. CurrentPage = 1
  76. End If
  77. Do while not RS.eof
  78. If RS("AnounName")="游客" Then
  79. Response.Write ""&RS("AnounName")&"说:<br/>" &vbcrlf
  80. Else
  81. Response.Write "<a href=""../User/ShowUser.asp?Keyword="&RS("AnounName")&"&amp;"&KS.WapValue&""">" & KS.GetUserRealName(RS("AnounName")) & "</a>说:<br/>" &vbcrlf
  82. End If
  83. Response.Write KS.ReplaceFace(KS.LoseHtml(RS("Content"))) &vbcrlf
  84. Response.Write "("&KS.DateFormat(RS("AddDate"),17)&"发表)<br/>" &vbcrlf
  85. If Session("Comment_"&RS("ID")&"1")<>""&RS("ID")&"1" Then
  86. Response.write "<a href="""&DomainStr&"Plus/Comment.asp?Action=support&amp;ChannelID="&ChannelID&"&amp;InfoID="&InfoID&"&amp;id="&RS("ID")&"&amp;Type=1&amp;" & KS.WapValue & """>顶("&RS("score")&")</a> " &vbcrlf
  87. Else
  88. Response.write "顶("&RS("score")&") " &vbcrlf
  89. End If
  90. If Session("Comment_"&RS("ID")&"0")<>""&RS("ID")&"0" Then
  91. Response.write "<a href="""&DomainStr&"Plus/Comment.asp?Action=support&amp;ChannelID="&ChannelID&"&amp;InfoID="&InfoID&"&amp;id="&RS("ID")&"&amp;Type=0&amp;" & KS.WapValue & """>倒("&RS("oscore")&")</a><br/>"
  92. Else
  93. Response.write "倒("&RS("oscore")&")<br/>" &vbcrlf
  94. End If
  95. RS.Movenext
  96. I = I + 1
  97. If I >= MaxPerPage Then Exit Do
  98. Loop
  99. Call KS.ShowPageParamter(totalPut, MaxPerPage, "Comment.asp", True, "个"&listtype&"", CurrentPage, "ChannelID="&ChannelID&"&amp;InfoID="&InfoID&"&amp;"&KS.WapValue&"")
  100. Response.Write "<br/>" &vbcrlf
  101. End if
  102. RS.Close:set RS=Nothing
  103. %>
  104. -----------<br/>
  105. <%
  106. Dim k,str:str="惊讶|撇嘴|色|发呆|得意|流泪|害羞|闭嘴|睡|大哭|尴尬|发怒|调皮|呲牙|微笑|难过|酷|非典|抓狂|吐|"
  107. Dim strArr:strArr=Split(str,"|")
  108. Dim reSayArry
  109. reSayArry = Array("要顶!","你牛!我顶!","这个不错!该顶!","支持你!","反对你!")
  110. Randomize
  111. %>
  112. <select name="insertface">
  113. <option value=""></option>
  114. <%
  115. For k=0 to 19
  116. Response.Write "<option value=""[e"&k&"]"">" & strArr(k) & "</option>" &vbcrlf
  117. Next
  118. %>
  119. </select>
  120. <input name="C_Content<%=Minute(Now)%><%=Second(Now)%>" type="text" maxlength="<%=KS.C_S(ChannelID,14)%>" size="20" value="<%=reSayArry(Int(Ubound(reSayArry)*Rnd))%>"/>
  121. <%
  122. If KS.C_S(ChannelID,13)="1" Then
  123. Response.Write "认证码:<input name=""VerifyCode"&Minute(Now)&Second(Now)&""" type=""text"" size=""4"" /><b>" & KS.GetVerifyCode & "</b>"
  124. End IF
  125. %>
  126. <anchor>发表评论<go href='Comment.asp?Action=writesave&amp;<%=KS.WapValue%>' method='post' accept-charset="utf-8">
  127. <postfield name='ChannelID' value='<%=ChannelID%>'/>
  128. <postfield name='InfoID' value='<%=InfoID%>'/>
  129. <postfield name='insertface' value='$(insertface)'/>
  130. <postfield name='C_Content' value='$(C_Content<%=Minute(Now)%><%=Second(Now)%>)'/>
  131. <postfield name='VerifyCode' value='$(VerifyCode<%=Minute(Now)%><%=Second(Now)%>)'/>
  132. </go></anchor>
  133. <br/>
  134. -----------<br/>
  135. <%
  136. End Sub
  137. '首页结束=================================================================================
  138. '投票开始=================================================================================
  139. Sub Support()
  140. Dim ID:ID=KS.ChkClng(KS.S("ID"))
  141. Dim OpType:OpType=KS.ChkClng(KS.S("Type"))
  142. Dim RS:Set RS=Server.CreateObject("Adodb.Recordset")
  143. RS.Open "Select * from KS_Comment Where ID="&ID&"",Conn,1,3
  144. If not RS.EOF Then
  145. If OpType=1 Then
  146. RS("Score")=RS("Score")+1
  147. Else
  148. RS("OScore")=RS("OScore")+1
  149. End If
  150. RS.UpDate
  151. End If
  152. RS.Close:Set RS=Nothing
  153. Session("Comment_" & ID & OpType)=ID & OpType
  154. Response.Redirect DomainStr&"Plus/Comment.asp?Action=CommentMain&ChannelID="&ChannelID&"&InfoID="&InfoID&"&"&KS.WapValue&""
  155. End Sub
  156. '投票结束=================================================================================
  157. '保存发表开始=================================================================================
  158. Sub WriteSave()
  159. Dim OutTimes,AnounName,Pass,insertface,C_Content,VerifyCode,Anonymous,point
  160. OutTimes = 60 '设置防刷新时间
  161. AnounName=KS.R(KS.S("AnounName"))
  162. Pass=KS.R(KS.G("Pass"))
  163. 'Email=KS.S("Email")
  164. insertface=KS.S("insertface")
  165. C_Content=KS.S("C_Content")
  166. C_Content=insertface&C_Content
  167. VerifyCode=KS.R(KS.S("VerifyCode"))
  168. Anonymous=KS.ChkClng(KS.S("Anonymous"))
  169. point=KS.ChkClng(KS.S("point"))
  170. If KS.C_S(ChannelID,13)="1" And Trim(Verifycode)<>Trim(Session("Verifycode")) Then
  171. Response.Write "验证码有误,请重新输入!<br/>"
  172. Response.write "<anchor>返回重写<prev/></anchor><br/><br/>"
  173. Exit Sub
  174. End IF
  175. If Cbool(KSUser.UserLoginChecked)=False Then
  176. AnounName = "游客"
  177. Anonymous = 1
  178. OK="OK"
  179. Else
  180. AnounName = KSUser.UserName
  181. Locked=KSUser.Locked
  182. Anonymous = 0
  183. End IF
  184. IF Anonymous=0 And Locked=1 Then
  185. Response.Write "您的账号已被管理员锁定,请与管理员联系或选择游客发表!<br/><br/>"
  186. ElseIf InfoID="" or InStr(C_Content, "c_content") > 0 Then
  187. Response.Write "参数传递有误!<br/>"
  188. Response.write "<anchor>返回重写<prev/></anchor><br/><br/>"
  189. ElseIf DateDiff("s", Session("OutTimes"), Now()) < OutTimes Then
  190. Response.Write "评论已提交,等待"&OutTimes&"秒钟后您可继续发表...<br/>"
  191. Response.write "<anchor>返回上级<prev/></anchor><br/><br/>"
  192. ElseIf C_Content="" Then
  193. Response.write "请填写评论内容!<br/>"
  194. Response.write "<anchor>返回重写<prev/></anchor><br/><br/>"
  195. ElseIf Len(C_Content)>KS.C_S(ChannelID,14) And KS.C_S(ChannelID,14)<>0 Then
  196. Response.write "评论内容必须在" & KS.C_S(ChannelID,14) & "个字符以内!!<br/>"
  197. Response.write "<anchor>返回重写<prev/></anchor><br/><br/>"
  198. Else
  199. Set RS=Server.CreateObject("ADODB.RECORDSET")
  200. if KS.C_S(Channelid,12)=1 Or KS.C_S(Channelid,12)=3 then
  201. verific=0
  202. else
  203. verific=1
  204. end if
  205. RS.Open "Select * From KS_Comment Where 1=0",Conn,1,3
  206. RS.AddNew
  207. RS("ChannelID")=ChannelID'频道ID
  208. RS("InfoID")=InfoID'信息ID
  209. RS("AnounName")=AnounName'昵称
  210. RS("UserName")=AnounName'会员名
  211. RS("Anonymous")=Anonymous'0匿名发布1会员发表
  212. RS("Email")="418704@QQ.com"'用户邮箱
  213. RS("Content")=KS.HTMLEncode(C_Content)'评论内容
  214. RS("UserIP")=KS.GetIP'用户IP
  215. RS("Point")=point
  216. RS("Score")=0'评论得票数(支持情况)
  217. RS("OScore")=0'评论反对票数(不支持情况)
  218. RS("Verific")=Verific'审核与否 0未审1已审
  219. RS("AddDate")=Now
  220. RS.UpDate
  221. RS.Close:Set RS=Nothing
  222. Response.write "你的评论发表成功!<br/>"
  223. Response.Write "<a href=""Comment.asp?Action=CommentMain&amp;ChannelID="&ChannelID&"&amp;InfoID="&InfoID&"&amp;" & KS.WapValue & """>查看评论</a><br/>"
  224. Session("OutTimes")=Now()
  225. End IF
  226. End Sub
  227. '保存发表结束=================================================================================
  228. %>