ShowNote.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:17k
源码类别:

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../FS_Inc/Const.asp" -->
  3. <!--#include file="../FS_InterFace/MF_Function.asp" -->
  4. <!--#include file="../FS_InterFace/ns_Function.asp" -->
  5. <!--#include file="../FS_Inc/Function.asp" -->
  6. <!--#include file="../FS_Inc/Func_page.asp" -->
  7. <%
  8. response.buffer=true
  9. Response.CacheControl = "no-cache"
  10. Dim Conn,User_Conn
  11. Dim Configobj,PageS,sql,MSTitle,ShowIP,IsUser,tmp_IsUser,s_reUserMember,style
  12. MF_Default_Conn
  13. MF_User_Conn
  14. Set Configobj= server.CreateObject (G_FS_RS)
  15. sql="select ID,Title,IPShow,IsUser,IsAut,PageSize,Style,RepUserMember From FS_WS_Config"
  16. configobj.open sql,Conn,1,1
  17. if not configobj.eof then
  18. PageS=configobj("PageSize")
  19. MSTitle=configobj("Title")
  20. ShowIP=configobj("IPShow")
  21. IsUser=configobj("isUser")
  22. s_reUserMember =configobj("RepUserMember")
  23. if s_reUserMember="" or not isnumeric(s_reUserMember) then
  24. s_reUserMember = 0
  25. else
  26. s_reUserMember = s_reUserMember
  27. end if
  28. Style = configobj("Style")
  29. if Style<>"" then
  30. Style = Style
  31. else
  32. Style = "3"
  33. end if
  34. end if
  35. response.Cookies("FoosunUserCookies")("UserLogin_Style_Num") = Style
  36. set configobj=nothing
  37. if IsUser="0" then
  38. tmp_IsUser = true
  39. else
  40. if session("Fs_UserName")<>"" then
  41. tmp_IsUser = true
  42. else
  43. tmp_IsUser = false
  44. end if
  45. end if
  46. '---分页
  47. Dim int_Start,int_RPP,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo
  48. int_RPP=PageS '设置每页显示数目
  49. toF_="<font face=webdings>9</font>"    '首页 
  50. str_nonLinkColor_="#999999" '非热链接颜色
  51. 'int_RPP = 30
  52. int_showNumberLink_=10 '数字导航显示数目
  53. showMorePageGo_Type_ = 1 '是下拉菜单还是输入值跳转,当多次调用时只能选1
  54. toF_="<font face=webdings>9</font>"    '首页 
  55. toP10_=" <font face=webdings>7</font>" '上十
  56. toP1_=" <font face=webdings>3</font>" '上一
  57. toN1_=" <font face=webdings>4</font>" '下一
  58. toN10_=" <font face=webdings>8</font>" '下十
  59. toL_="<font face=webdings>:</font>"
  60. %>
  61. <html>
  62. <HEAD>
  63. <TITLE>FoosunCMS留言系统</TITLE>
  64. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
  65. </HEAD>
  66. <link href="../<% = G_USER_DIR %>/images/skin/Css_<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>/<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  67. <script language="javascript">
  68. function AddNote(ClassID,ClassName,user,IsUser)
  69. {
  70. if(user==""){
  71. if(IsUser=="1")
  72. {
  73. alert("对不起,还没开发非会员留言权限!");
  74. return false;
  75. }
  76. else
  77. {
  78. location='AddnewNotes.asp?ClassID='+ClassID+'&ClassName='+ClassName;
  79. return true;
  80. }
  81. }
  82. else
  83.    {
  84. location='AddnewNotes.asp?ClassID='+ClassID+'&ClassName='+ClassName;
  85. return true;
  86. }
  87. }
  88. function showRep(cat,user,isUser)
  89. {
  90. if(user==""){
  91. if(isUser=="1"){
  92. alert("对不起,还没开放非会员留言权限!");
  93. }
  94. else{
  95.  cat.style.display="";
  96.     document.showBbs.Content.focus();
  97. }
  98.  }
  99. else{
  100.   cat.style.display="";
  101.   document.showBbs.Content.focus();
  102.  }
  103. }
  104. function ShowNote(NoteID,ClassName,ClassID)
  105. {
  106. alert(ClassID);
  107. location="ShowNote.asp?NoteID="+NoteID+"&ClassName="+ClassName+"&ClassID="+ClassID;
  108. }
  109. </script>
  110. <body>
  111. <%
  112. Dim ID,NoteID,NoteRs,ClassName,ClassID,BbsRs,Topic,UserName,Face,Content,i
  113. Set NoteRs=Server.CreateObject(G_FS_RS)
  114. Set BbsRs=Server.CreateObject(G_FS_RS)
  115. if NoSqlHack(Request.QueryString("NoteID"))<>"" then
  116. ID=NoSqlHack(Trim(Request.QueryString("NoteID")))
  117. ClassName=NoSqlHack(trim(Request.QueryString("ClassName")))
  118. ClassID=NoSqlHack(Trim(Request.queryString("ClassID")))
  119. Conn.execute("Update FS_WS_BBS set Hit=(Hit+1) Where ID="&ID&"")
  120. NoteRs.open "Select ID,ClassID,User,Topic,Body,AddDate,IsTop,State,Style,IsAdmin,Answer,Hit,LastUpdateDate,LastUpdateUser,Face,IP  From FS_WS_BBS Where ID="&ID&"",Conn,1,1
  121. if not NoteRs.eof then
  122. %>
  123.  <form name="showBbs" id="showBbs" action="?Act=AddRe" method="post">
  124.       <table width="98%" border="0" align="center" cellpadding="4" cellspacing="1" class="table">
  125.   <tr> 
  126.     <td height="36" colspan="2" align="left" class="xingmu"><img src="images/Forum_nav.gif"> <a href="index.asp" class="Top_Navi"><b><%=MSTitle%></b></a> -> <a href="DefNoteList.asp?ClassID=<%=ClassID%>" class="Top_Navi"><b><%=ClassName%></b></a>-&gt;<%=NoteRs("Topic")%><input type="hidden" name="ClassName" value="<%=ClassName%>"></td> 
  127.   </tr>
  128.   <tr>
  129.    <td class="hback" colspan="2" >
  130. <img src="images/postnew.gif" alt="发表贴子" width="85" height="26" style="CURSOR: hand" onMouseUp="return AddNote('<%=ClassID%>','<%=ClassName%>','<%=session("FS_UserName")%>','<%=IsUser%>')">&nbsp;&nbsp;&nbsp;&nbsp;<%if tmp_IsUser = true then%><img src="images/mreply.gif" alt="发表贴子" width="85" height="26" style="CURSOR: hand" onMouseUp="showRep(REP,'<%=session("FS_UserName")%>','<%=IsUser%>')"><%end if%> </td>
  131.   </tr>
  132.   <tr>
  133.    <td class="hback" width="12%" rowspan="2">
  134. <%if NoteRs("User")<>"游客" and NoteRs("User")<>"过客" then%>
  135. <a href="../<%=G_USER_DIR%>/ShowUser.asp?UserName=<%=NoteRs("User")%>" target="_blank"><b><%=NoteRs("User")%></b></a><br>
  136. <%else%>
  137. <b><%=NoteRs("User")%></b><br>
  138. <%
  139. end if
  140. MF_User_Conn
  141. dim  h_rs
  142. set h_rs = User_Conn.execute("select HeadPic,UserName,HeadPicSize From FS_ME_Users where UserName = '"& NoSqlHack(NoteRs("User"))&"'")
  143. if not h_rs.eof then
  144. if trim(h_rs("HeadPic"))<>"" then
  145. if instr(h_rs("HeadPicSize"),",")>0 then
  146. response.Write "<img src = """& h_rs("HeadPic")&""" height="""& split(h_rs("HeadPicSize"),",")(1)&""" width="""&split(h_rs("HeadPicSize"),",")(0)&""" />"
  147. else
  148. response.Write "<img src = ""../sys_images/nopic_supply.gif"" border=""0"" />"
  149. end if
  150. else
  151. response.Write "<img src = ""../sys_images/nopic_supply.gif"" border=""0"" />"
  152. end if
  153. h_rs.close:set h_rs= nothing
  154. else
  155. response.Write "<img src = ""../sys_images/nopic_supply.gif"" border=""0"" />"
  156. h_rs.close:set h_rs= nothing
  157. end if
  158. %>
  159. <br><img src="images/ip.gif">
  160. <%
  161. if ShowIP="0" then 
  162. Response.Write(NoteRs("IP")&"<br>") 
  163. end if
  164. %>
  165. <%=NoteRs("AddDate")%> </td>
  166. <td width="88%" height="2" class="hback"><strong><img src="Images/face<% = NoteRs("Face")%>.gif" width="22" height="22"><%=NoteRs("Topic")%></strong></td>
  167.   </tr>
  168.   <tr>
  169.    <td height="74" class="hback">&nbsp;<%=NoteRs("Body")%><br>
  170.      <%
  171. if session("FS_UserName")=NoteRs("User") then
  172. %>
  173.       <div align="right"><a href="EditBBS.asp?Act=Edit&BBSID=<%=NoteRs("ID")%>&ClassName=<%=ClassName%>&NoteID=<%=NoteRs("ID")%>&Page=<%=cPageNo%>&ClassID=<%=NoteRs("ClassID")%>&NoteTilte=<%=NoteRs("Topic")%>">[编辑此贴子]</a>&nbsp;&nbsp;<a href="BBsDel.asp?Act=SinglDel&BBSID=<%=NoteRs("ID")%>&ClassName=<%=ClassName%>&NoteID=<%=NoteRs("ID")%>&Page=<%=cPageNo%>&ClassID=<%=NoteRs("ClassID")%>&NoteTilte=<%=NoteRs("Topic")%>" onClick="{if(confirm('确定要删除吗?')){this.document.inbox.submit();return true;}return false;}">[删除此帖子]</a>&nbsp;&nbsp;</div>
  174.       <%end if%></td>
  175.   </tr>
  176.     <%
  177.    BbsRs.open "Select ID,ClassID,User,ParentID,Topic,Body,AddDate,IsTop,State,Style,IsAdmin,Answer,Hit,LastUpdateDate,LastUpdateUser,Face,IP  From FS_WS_BBS Where ParentID='"&ID&"' order by AddDate",Conn,1,1
  178. if not BbsRs.eof then
  179. BbsRs.PageSize=int_RPP
  180. cPageNo=NoSqlHack(Request.QueryString("Page"))
  181. If cPageNo="" Then 
  182. cPageNo = 1
  183. End if
  184. If not isnumeric(cPageNo) Then 
  185. cPageNo = 1
  186. cPageNo = Clng(cPageNo)
  187. End If
  188. If cPageNo<=0 Then 
  189. cPageNo=1
  190. End If
  191. If cPageNo>BbsRs.PageCount Then 
  192. cPageNo=BbsRs.PageCount 
  193. BbsRs.AbsolutePage=cPageNo
  194. End IF
  195. i=1
  196. FOR int_Start=1 TO int_RPP
  197. i=i+1 
  198. %>
  199.   <tr>
  200.    <td class="hback"
  201.  width="14%" rowspan="2">
  202. <%if BbsRs("User")<>"游客" and BbsRs("User")<>"过客" then%>
  203. <a href="../<%=G_USER_DIR%>/ShowUser.asp?UserName=<%=BbsRs("User")%>" target="_blank"><b><%=BbsRs("User")%></b></a><br>
  204. <%else%>
  205. <b><%=BbsRs("User")%></b><br>
  206. <%
  207. end if
  208. set h_rs = User_Conn.execute("select HeadPic,UserName,HeadPicSize From FS_ME_Users where UserName = '"& NoSqlHack(BbsRs("User"))&"'")
  209. if not h_rs.eof then
  210. if trim(h_rs("HeadPic"))<>"" then
  211. if instr(h_rs("HeadPicSize"),",")>0 then
  212. response.Write "<img src = """& h_rs("HeadPic")&""" height="""& split(h_rs("HeadPicSize"),",")(1)&""" width="""&split(h_rs("HeadPicSize"),",")(0)&""" />"
  213. else
  214. response.Write "<img src = ""../sys_images/nopic_supply.gif"" border=""0"" />"
  215. end if
  216. else
  217. response.Write "<img src = ""../sys_images/nopic_supply.gif"" border=""0"" />"
  218. end if
  219. h_rs.close:set h_rs= nothing
  220. else
  221. response.Write "<img src = ""../sys_images/nopic_supply.gif"" border=""0"" />"
  222. h_rs.close:set h_rs= nothing
  223. end if
  224. %>
  225. <br>
  226. <img src="images/ip.gif"><%
  227. if ShowIP="0" then 
  228. Response.Write(NoteRs("IP")&"<br>") 
  229. end if
  230. %>
  231. <%=BbsRs("AddDate")%> </td>
  232. <td class="hback"
  233.  width="86%" height="5"><div align="left">第<%=int_Start%>楼</div>
  234.   </iv></td>
  235.   </tr>
  236.   <tr>
  237.    <td class="hback"
  238. ><img src="Images/face<%=BbsRs("Face")%>.gif" width="22" height="22"><%=BbsRs("Body")%><br>
  239. <%
  240. if session("FS_UserName")=BbsRs("User") then
  241. %>
  242. <div align="right"><a href="EditBBS.asp?Act=Edit&BBSID=<%=BbsRs("ID")%>&ClassName=<%=ClassName%>&NoteID=<%=NoteRs("ID")%>&Page=<%=cPageNo%>&ClassID=<%=NoteRs("ClassID")%>&NoteTilte=<%=NoteRs("Topic")%>">[编辑此贴子]</a>&nbsp;&nbsp;<a href="BBsDel.asp?Act=SinglDel&BBSID=<%=BbsRs("ID")%>&ClassName=<%=ClassName%>&NoteID=<%=NoteRs("ID")%>&Page=<%=cPageNo%>&ClassID=<%=NoteRs("ClassID")%>&NoteTilte=<%=NoteRs("Topic")%>" onClick="{if(confirm('确定要删除吗?')){this.document.inbox.submit();return true;}return false;}">[删除此帖子]</a>&nbsp;&nbsp;</div>
  243. <%end if%> 
  244. </td>
  245.   </tr>
  246. <%
  247. BbsRs.MoveNext
  248. if BbsRs.eof or BbsRs.bof then exit for
  249.     NEXT
  250. Response.Write("<tr><td class=""hback"" colspan=""2"" align=""right"">"&fPageCount(BbsRs,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo)  & vbcrlf&"</td></tr>")
  251. end if
  252.     BbsRs.close
  253.    %>
  254.    <td class="hback" colspan="2" ><img src="images/postnew.gif" alt="发表贴子" width="85" height="26" style="CURSOR: hand" onMouseUp="return AddNote('<%=ClassID%>','<%=ClassName%>','<%=session("FS_UserName")%>','<%=IsUser%>')">&nbsp;&nbsp;&nbsp;&nbsp;<%if tmp_IsUser = true then%><img src="images/mreply.gif" alt="发表贴子" width="85" height="26" style="CURSOR: hand" onMouseUp="showRep(REP,'<%=session("FS_UserName")%>','<%=IsUser%>')"><%end if%> </td>
  255.   </tr>
  256.   <%if tmp_IsUser = true then%>
  257.   <tr ID="REP"  style="display:">
  258.    <td colspan="2" class="hback"> 
  259.  <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolor="0"> 
  260.    <tr>
  261.    <td class="tdtitle" colspan="2" width="100%">快速回复帖子</td>
  262.    </tr>
  263. <tr>
  264. <td align="right" width="15%">用户名</td>
  265. <td><input type="text" id="UserName" name="UserName" size="23" maxlength="50" <% 
  266. if session("FS_UserName")="" then 
  267. Response.write ("value=""游客""") 
  268. else 
  269. response.write("value="&session("FS_UserName")&"")
  270. end if
  271. %>
  272.  readonly></td>
  273. </tr>
  274. <td  align="right" height="25">表情</td>
  275. <td  ><table width="100%" border="0" cellspacing="0" cellpadding="0">
  276.                   <tr> 
  277.                     <td> <input name="FaceNum" type="radio" value="1" checked> 
  278.                       <img src="Images/face1.gif" width="22" height="22"> </td>
  279.                     <td> <input type="radio" name="FaceNum" value="2"> <img src="Images/face2.gif" width="22" height="22">                    </td>
  280.                     <td> <input type="radio" name="FaceNum" value="3"> <img src="Images/face3.gif" width="22" height="22">                    </td>
  281.                     <td> <input type="radio" name="FaceNum" value="4"> <img src="Images/face4.gif" width="22" height="22">                    </td>
  282.                     <td> <input type="radio" name="FaceNum" value="5"> <img src="Images/face5.gif" width="22" height="22">                    </td>
  283.                     <td> <input type="radio" name="FaceNum" value="6"> <img src="Images/face6.gif" width="22" height="22"></td>
  284.                     <td> <input type="radio" name="FaceNum" value="7"> <img src="Images/face7.gif" width="22" height="22">                    </td>
  285.                     <td> <input type="radio" name="FaceNum" value="8"> <img src="Images/face8.gif" width="22" height="22">                    </td>
  286.                     <td> <input type="radio" name="FaceNum" value="9"> <img src="Images/face9.gif" width="22" height="22"></td>
  287.                   </tr>
  288.                   <tr> 
  289.                     <td> <input type="radio" name="FaceNum" value="10"> <img src="Images/face10.gif" width="22" height="22"></td>
  290.                     <td> <input type="radio" name="FaceNum" value="11"> <img src="Images/face11.gif" width="22" height="22">                    </td>
  291.                     <td> <input type="radio" name="FaceNum" value="12"> <img src="Images/face12.gif" width="22" height="22"></td>
  292.                     <td> <input type="radio" name="FaceNum" value="13"> <img src="Images/face13.gif" width="22" height="22">                    </td>
  293.                     <td> <input type="radio" name="FaceNum" value="14"> <img src="Images/face14.gif" width="22" height="22"></td>
  294.                     <td> <input type="radio" name="FaceNum" value="15"> <img src="Images/face15.gif" width="22" height="22"></td>
  295.                     <td> <input type="radio" name="FaceNum" value="16"> <img src="Images/face16.gif" width="22" height="22"></td>
  296.                     <td> <input type="radio" name="FaceNum" value="17"> <img src="Images/face17.gif" width="22" height="22">                    </td>
  297.                     <td> <input type="radio" name="FaceNum" value="18"> <img src="Images/face18.gif" width="22" height="22">                    </td>
  298.                   </tr>
  299.                 </table>
  300. </td>
  301. <tr>
  302. <td  align="right">内容</td>
  303. <td  valign="top" ><textarea name="Content" id="Content" rows="8" style="width:90%"></textarea></td>
  304. </tr>
  305. <tr>
  306. <td  >&nbsp;<input type="hidden" name="ClassID" value="<%=ClassID%>"><input type="hidden" name="NoteID" value="<%=NoteRs("ID")%>"><input type="hidden" name="Topic" value="<%=NoteRs("Topic")%>"><input type="hidden" name="ID" value="<%=ID%>"></td>
  307.  <td ><input type="submit" name="submit" value="回复帖子">&nbsp;&nbsp;
  308.     <input type="reset" name="reset" value=" 清  空 "></td>
  309. </tr>
  310.     </table>
  311. </td>
  312.   </tr>
  313.   <%end if%>
  314.   </table>
  315. </form>
  316. <%
  317. end if
  318. end if
  319. Set NoteRs=nothing
  320. if NoSqlHack(Request("Act"))="AddRe" then
  321. ID=NoSqlHack(Request.form("ID"))
  322. NoteID=NoSqlHack(Request.form("NoteID"))
  323. ClassID=NoSqlHack(Request.form("ClassID"))
  324. Topic=NoSqlHack(Request.form("Topic"))
  325. UserName=NoSqlHack(Request.form("UserName"))
  326. Face=NoSqlHack(Request.form("FaceNum"))
  327. Content=replace(NoHtmlHackInput(trim(Request.form("Content"))),chr(13)&chr(10),"<br>")
  328. ClassName=NoSqlHack(Request.form("ClassName"))
  329. if NoteID="" or ClassID="" or ID="" or Topic="" or UserName="" or Face="" or ClassName="" then
  330. Response.write ("<script>alert('参数出错!');history.back();</script>")
  331. response.end
  332. end if
  333. if Content="" then 
  334. Response.write ("<script>alert('留言内容不能为空!');history.back();</script>")
  335. response.end
  336. end if
  337. BbsRs.open "Select ID,ClassID,User,ParentID,Topic,Body,AddDate,IsTop,State,Style,IsAdmin,Answer,Hit,LastUpdateDate,LastUpdateUser,Face,IP  From FS_WS_BBS Where 1=2",Conn,3,3
  338. BbsRs.Addnew
  339. BbsRs("ClassID")=ClassID
  340. BbsRs("User")=UserName
  341. BbsRs("ParentID")=ID
  342. BbsRs("topic")=Topic
  343. BbsRs("Body")=Content
  344. BbsRs("AddDate")=now()
  345. BbsRs("LastUpdateDate")=now()
  346. BbsRs("LastUpdateUser")=UserName
  347. BbsRs("Face")=Face
  348. BbsRs("IP")=Request.ServerVariables("REMOTE_ADDR")
  349. BbsRs.update
  350. Set BbsRs=nothing
  351. Conn.execute("Update FS_WS_BBS set Answer=(Answer+1),LastUpdateDate='"&now()&"',LastUpdateUser='"&UserName&"' Where ID="&ID&"")
  352. '更新会员积分
  353. if session("FS_UserName")<>"" then
  354. User_Conn.execute("Update FS_ME_Users set Integral=Integral+"& s_reUserMember &" where UserName='"& session("FS_UserName")&"'")
  355. if s_reUserMember<>0 then
  356. dim f_AddlogObj
  357. Set f_AddlogObj = server.CreateObject(G_FS_RS)
  358. f_AddlogObj.open "select  * From FS_ME_Log where 1=0",User_Conn,1,3
  359. f_AddlogObj.addnew
  360. f_AddlogObj("LogType")="其他"
  361. f_AddlogObj("UserNumber")=GetFriendNumber(session("FS_UserName"))
  362. f_AddlogObj("points")=s_reUserMember
  363. f_AddlogObj("moneys")=0
  364. f_AddlogObj("LogTime")=Now
  365. f_AddlogObj("LogContent")="发表帖子增加积分"
  366. f_AddlogObj("Logstyle")=0
  367. f_AddlogObj.update
  368. f_AddlogObj.close
  369. set f_AddlogObj = nothing
  370. end if 
  371. end if
  372. Response.Redirect("ShowNote.asp?NoteID="&NoteID&"&ClassName="&ClassName&"&ClassID="&ClassID&"")
  373. end if
  374. Function GetFriendNumber(f_strNumber)
  375. Dim RsGetFriendNumber
  376. Set RsGetFriendNumber = User_Conn.Execute("Select UserNumber From FS_ME_Users Where UserName = '"& f_strNumber &"'")
  377. If  Not RsGetFriendNumber.eof  Then 
  378. GetFriendNumber = RsGetFriendNumber("UserNumber")
  379. End If 
  380. set RsGetFriendNumber = nothing
  381. End Function 
  382. Set Conn=nothing
  383. set User_Conn = nothing
  384. %>
  385. </body>
  386. </html>