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

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../FS_Inc/Const.asp" -->
  3. <!--#include file="../FS_InterFace/MF_Function.asp" -->
  4. <!--#include file="../FS_Inc/Function.asp" -->
  5. <!--#include file="lib/strlib.asp" -->
  6. <!--#include file="lib/UserCheck.asp" -->
  7. <%
  8. dim str_m_type
  9. str_m_type = NoSqlHack(Request.QueryString("M_type"))
  10. if isnull(str_m_type) or not isnumeric(str_m_type) or trim(str_m_type)="" then
  11. strShowErr = "<li>错误参数</li>"
  12. Response.Redirect("lib/error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  13. Response.end
  14. end if
  15. if NoSqlHack(request.QueryString("ToUserNumber")) = Fs_User.UserNumber then
  16. strShowErr = "<li>不能自己给自己留言</li>"
  17. Call ReturnError(strShowErr,"")
  18. End if
  19. Dim P_ToUserNumber,P_strToUserNumber,GetUsermessObj,FS_Book
  20. Set FS_Book = new Cls_message
  21. P_ToUserNumber = NoSqlHack(Request.QueryString("ToUserNumber"))
  22. '获得用户名和编号
  23. Set GetUsermessObj = server.CreateObject(G_FS_RS)
  24. GetUsermessObj.open "select  UserID,isLock,UserName,GroupID,UserNumber From FS_ME_Users where UserNumber = '"& P_ToUserNumber &"'",User_Conn,1,3
  25. if GetUsermessObj.eof then
  26. P_strToUserNumber = ""
  27. Else
  28. P_strToUserNumber = GetUsermessObj("UserName")
  29. End if
  30. If Request.Form("Action") = "Save" then
  31. Dim p_M_ReadUserName,p_M_title,p_M_Content,p_M_Type
  32. p_M_ReadUserName = NoSqlHack(Request.Form("M_ReadUserNumber"))
  33. p_M_title = NoSqlHack(Request.Form("Title"))
  34. p_M_Content = NoHtmlHackInput(Request.Form("Content"))
  35. p_M_Type= NoSqlHack(Request.Form("M_Type"))
  36. If p_M_ReadUserName="" Or p_M_title="" Or p_M_Content="" Then
  37. strShowErr = "<li>请填写完整</li><li>留言标题、收件人、信息内容不能为空</li>"
  38. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  39. Response.end
  40. End If
  41. If len(p_M_Content)>500 Then
  42. strShowErr = "<li>留言内容不能超过500个字符</li>"
  43. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  44. Response.end
  45. End If
  46. If Trim(p_M_ReadUserName)=Fs_User.UserName Then
  47. strShowErr = "<li>不能自己给自己留言</li>"
  48. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  49. Response.end
  50. End if
  51. Dim Returvaluestr
  52. Returvaluestr = Fs_User.GetFriendNumber(p_M_ReadUserName)
  53. Dim t_RsCheckFriend
  54. if Returvaluestr ="0" then
  55. strShowErr = "<li>找不到会员信息,可能您发送的会员已经删除</li>"
  56. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  57. Response.end
  58. Else
  59. Set t_RsCheckFriend = User_Conn.Execute("select FriendType from FS_ME_Friends where UserNumber='"&Returvaluestr&"' and F_UserNumber='"&Fs_User.UserNumber&"' and FriendType=2")
  60. If Not t_RsCheckFriend.EOF Then 
  61. strShowErr = "<li>对方已将你列入黑名单,不能再给他留言</li>"
  62. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  63. Response.end
  64. End If
  65. End if
  66. If Fs_User.UserExist(Returvaluestr)=False then
  67. strShowErr = "<li>没有此用户或者此用户已经被锁定</li>"
  68. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  69. Response.end
  70. End If
  71. Set t_RsCheckFriend = Nothing 
  72. Set FS_Book = new Cls_message
  73. If FS_Book.LenbContent(Returvaluestr)+Len(Request.Form("Content")) > 100*1024 then
  74. strShowErr = "<li>对方短信空间容量已满!请通知对方删除多余短信</li>"
  75. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  76. Response.end
  77. End If
  78. dim save_rs
  79. set save_rs= Server.CreateObject(G_FS_RS)
  80. save_rs.open "select * From FS_ME_Book where 1=0",User_Conn,1,3
  81. save_rs.addnew
  82. save_rs("M_Title")=p_M_title
  83. save_rs("M_ReadUserNumber")=Returvaluestr
  84. save_rs("M_Content")=p_M_Content
  85. save_rs("M_FromUserNumber")=Fs_User.UserNumber
  86. save_rs("M_FromDate")=now
  87. save_rs("M_ReadTF")=0
  88. save_rs("LenContent")=len(p_M_Content)
  89. save_rs("M_Type")=p_M_Type
  90. save_rs.update
  91. save_rs.close:set save_rs = nothing
  92. Set FS_Book = Nothing 
  93. strShowErr = "<li>恭喜!</li><li>发送成功</li>"
  94. Response.Redirect("lib/Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  95. Response.end
  96. Else
  97. %>
  98. <html xmlns="http://www.w3.org/1999/xhtml">
  99. <title>留言-网站内容管理系统</title>
  100. <meta name="keywords" content="风讯cms,cms,FoosunCMS,FoosunOA,FoosunVif,vif,风讯网站内容管理系统">
  101. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  102. <meta content="MSHTML 6.00.3790.2491" name="GENERATOR" />
  103. <meta name="Keywords" content="Foosun,FoosunCMS,Foosun Inc.,风讯,风讯网站内容管理系统,风讯系统,风讯新闻系统,风讯商城,风讯b2c,新闻系统,CMS,域名空间,asp,jsp,asp.net,SQL,SQL SERVER" />
  104. <link href="images/skin/Css_<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>/<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  105. <head>
  106. <body>
  107. <table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" class="table">
  108.   <tr>
  109.     <td>
  110.       <!--#include file="top.asp" -->
  111.     </td>
  112.   </tr>
  113. </table>
  114. <table width="98%" height="135" border="0" align="center" cellpadding="1" cellspacing="1" class="table">
  115.   
  116.     <tr class="back"> 
  117.       <td   colspan="2" class="xingmu" height="26"> <!--#include file="Top_navi.asp" --> </td>
  118.     </tr>
  119.     <tr class="back"> 
  120.       <td width="18%" valign="top" class="hback"> <div align="left"> 
  121.           <!--#include file="menu.asp" -->
  122.         </div></td>
  123.       <td width="82%" valign="top" class="hback"><table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  124.         <tr class="hback"> 
  125.           <td class="hback"><strong>位置:</strong><a href="../">网站首页</a> &gt;&gt; 
  126.             <a href="main.asp">会员首页</a> &gt;&gt;<a href="Book.asp?M_Type=<%=str_m_type%>">留言管理</a> &gt;&gt; 撰写留言</td>
  127.         </tr>
  128.       </table> 
  129.         
  130.       <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  131.         <form name="form1" method="post" action="">
  132.           <tr class="hback"> 
  133.             <td height="28" colspan="2" class="hback">
  134. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  135.                 <tr class="hback"> 
  136.                   <td class="hback"><div align="right">空间占用 </div></td>
  137.                   <td class="hback"><div align="left">: 
  138.                       <%
  139.      Dim UnTotle,FS_Book_1
  140.  Set FS_Book_1 = new Cls_message
  141. UnTotle=FS_Book_1.LenbContent(Fs_User.UserNumber)/(1024*100)*100
  142. Set FS_Book_1 = Nothing 
  143. If IsNull(UnTotle) then UnTotle=0
  144. Response.Write Formatnumber(UnTotle,2,-1)&"%"
  145. %>
  146.                     </div></td>
  147.                   <td width="80%" class="hback"><table width="100%" height="17" border="0" cellpadding="0" cellspacing="1" class="table">
  148.                       <tr> 
  149.                         <td class="hback_1"><img src="images/space_pic_<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>.gif" width="<% = Formatnumber((UnTotle),2,-1)%>%" height="17"></td>
  150.                       </tr>
  151.                     </table></td>
  152.                 </tr>
  153.               </table></td>
  154.           </tr>
  155.           <tr class="hback"> 
  156.             <td width="16%" class="hback_1"><div align="center"><strong>用 户 名</strong></div></td>
  157.             <td class="hback"> <div align="left"> 
  158.                 <input name="M_ReadUserNumber" type="text" id="M_ReadUserNumber" value="<% = P_strToUserNumber %>" size="20">
  159.                 <font color="#999999"> 
  160.                 <select name="SelectFriend" id="SelectFriend" onChange="DoTitle(this.options[this.selectedIndex].value)">
  161.                   <option selected value="">>>选择好友<<</option>
  162.                   <%=Fs_User.FriendList%> 
  163.                 </select>
  164.                 </font>请添写用户名<strong>|<a href="Friend_add.asp">添加好友</a></strong></div></td>
  165.           </tr>
  166.           <tr class="hback"> 
  167.             <td class="hback_1"><div align="center"><strong>留言标题</strong></div></td>
  168.             <td class="hback"> <div align="left"> 
  169.                 <input name="Title" type="text" id="Title" size="40">
  170.               </div></td>
  171.           </tr>
  172.           <tr class="hback"> 
  173.             <td class="hback_1"><div align="center"><strong>留言内容</strong></div></td>
  174.             <td class="hback"> <div align="left"> 
  175.                 <textarea name="Content" cols="50" rows="8" id="Content"></textarea>
  176.               </div></td>
  177.           </tr>
  178.           
  179.           <tr class="hback"> 
  180.             <td colspan="2" class="hback"> <div align="left">          
  181.                 <input name="Action" type="hidden" id="Action" value="Save">
  182.                 <input name="M_Type" type="hidden" id="M_Type" value="<%=str_m_type%>">
  183.                 <input type="submit" name="Submit" value=" 确定留言 ">
  184.                   
  185.                 <input type="reset" name="Submit3" value="重新填写">
  186.               </div></td>
  187.           </tr>
  188.           <tr class="hback"> 
  189.             <td colspan="2" class="hback"> <div align="center"> </div></td>
  190.           </tr>
  191.         </form>
  192.       </table>
  193.       </td>
  194.     </tr>
  195.     <tr class="back"> 
  196.       <td height="20"  colspan="2" class="xingmu"> <div align="left"> 
  197.           <!--#include file="Copyright.asp" -->
  198.         </div></td>
  199.     </tr>
  200.  
  201. </table>
  202. </body>
  203. </html>
  204. <script language="JavaScript" type="text/JavaScript">
  205. function DoTitle(addTitle) {  
  206. document.form1.M_ReadUserNumber.value=document.form1.SelectFriend.value;  
  207. document.form1.M_ReadUserNumber.focus(); 
  208.  return; 
  209. </script>
  210. <%
  211. End if
  212. Set Fs_User = Nothing
  213. %>
  214. <!--Powsered by Foosun Inc.,Product:FoosunCMS V4.0系列-->