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

数据库编程

开发平台:

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