Friend_add.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. Dim Returvaluestr_1,StrRealName,StrEmail,StrTel,Strmobile,StrQQ,StrMSN,StrContent,strFriendType,strFriendType_1
  9. if Request.Form("Action") = "Save" then
  10. Dim UserName ,RealName,ResultMTF,id
  11. UserName=NoSqlHack(Request.Form("UserName"))
  12. RealName=NoSqlHack(Request.Form("RealName"))
  13. id=NoSqlHack(Trim(Request.Form("ID")))
  14. if Trim(UserName) = "" or Trim(RealName) = ""  then
  15. strShowErr = "<li>请输入用户名及备注的姓名</li>"
  16. Call ReturnError(strShowErr,"")
  17. Elseif Len(Request.Form("Content"))>200  then
  18. strShowErr = "<li>备注不能大于200个字符</li>"
  19. Call ReturnError(strShowErr,"")
  20. Elseif UserName=Fs_User.UserName  then
  21. strShowErr = "<li>不能自己添加自己</li>"
  22. Call ReturnError(strShowErr,"")
  23. Else
  24. Dim Returvaluestr,RsCheckTFObj,RsGObj
  25. Returvaluestr = Fs_User.GetFriendNumber(UserName)
  26. Set RsGObj = server.CreateObject(G_FS_RS)
  27. RsGObj.open "select  isLock,UserID From FS_ME_Users where UserNumber = '"& Returvaluestr &"'",User_Conn,1,3
  28. if RsGObj.eof then
  29. strShowErr = "<li>找不到此用户!</li>"
  30. Call ReturnError(strShowErr,"")
  31. Else
  32. if RsGObj(0) =1 then
  33. strShowErr = "<li>用户已经被锁定,不能添加!</li>"
  34. Call ReturnError(strShowErr,"")
  35. End if
  36. End if
  37. Set RsCheckTFObj = server.CreateObject(G_FS_RS)
  38. RsCheckTFObj.open "select  FriendID From FS_ME_Friends where F_UserNumber = '"& Returvaluestr &"' and UserNumber='"& Fs_User.UserNumber&"'",User_Conn,1,3
  39. if Not RsCheckTFObj.eof then
  40. if id ="" then
  41. strShowErr = "<li>好友已经存在!</li>"
  42. Call ReturnError(strShowErr,"")
  43. End if
  44. End if
  45. Dim RsaddFLObj,addFLSQL,strUpdatechar
  46. if id <>"" then
  47. Set RsaddFLObj = server.CreateObject(G_FS_RS)
  48. addFLSQL = "select  * From FS_ME_Friends  where FriendID ="& id &""
  49. RsaddFLObj.open addFLSQL,User_Conn,1,3
  50. Else
  51. Set RsaddFLObj = server.CreateObject(G_FS_RS)
  52. addFLSQL = "select  * From FS_ME_Friends Where 1=0"
  53. RsaddFLObj.open addFLSQL,User_Conn,1,3
  54. RsaddFLObj.addnew
  55. End if
  56. RsaddFLObj("UserNumber") = Fs_User.UserNumber
  57. RsaddFLObj("FriendType") = cint(Request.Form("FriendType"))
  58. RsaddFLObj("F_UserNumber") = Returvaluestr
  59. RsaddFLObj("AddTime") = now
  60. RsaddFLObj("Updatetime") = now
  61. RsaddFLObj("RealName") = NoSqlHack(Request.Form("RealName"))
  62. RsaddFLObj("Content") = NoHtmlHackInput(Request.Form("Content"))
  63. RsaddFLObj("Email") = NoSqlHack(Request.Form("Email"))
  64. RsaddFLObj("Tel") = NoSqlHack(Request.Form("Tel"))
  65. RsaddFLObj("Mobile") = NoSqlHack(Request.Form("Mobile"))
  66. RsaddFLObj("QQ") = NoSqlHack(Request.Form("QQ"))
  67. RsaddFLObj("MSN") = NoSqlHack(Request.Form("MSN"))
  68. RsaddFLObj.update
  69. RsaddFLObj.close:set RsaddFLObj = nothing
  70. strShowErr = "<li>好友操作成功!</li>"
  71. Response.Redirect("lib/Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=../Friend.asp")
  72. Response.end
  73. End if
  74. End if
  75. if Request.QueryString("FriendID") <> "" then
  76. Dim FriendID
  77. FriendID = NoSqlHack(clng(Trim(Request.QueryString("FriendID"))))
  78. Dim RsUserFriendObj1,RsUserFriendSQL
  79. Set RsUserFriendObj1 = Server.CreateObject(G_FS_RS)
  80. RsUserFriendSQL = "Select FriendID,UserNumber,FriendType,F_UserNumber,AddTime,Updatetime,RealName,Content,Email,Tel,Mobile,QQ,MSN From FS_ME_Friends  where UserNumber='"&Fs_User.UserNumber&"' and FriendID = "& FriendID &" Order by FriendID desc"
  81. RsUserFriendObj1.Open RsUserFriendSQL,User_Conn,1,1
  82. If Trim(Request.QueryString("action"))="addFriend" then
  83. Returvaluestr_1 = Fs_User.GetFriendName(request.QueryString("ToUserNumber"))
  84. Else
  85. Returvaluestr_1 = Fs_User.GetFriendName(RsUserFriendObj1("F_UserNumber"))
  86. End if
  87. StrRealName = RsUserFriendObj1("RealName")
  88. StrEmail = RsUserFriendObj1("Email")
  89. StrTel = RsUserFriendObj1("Tel")
  90. Strmobile = RsUserFriendObj1("mobile")
  91. StrQQ = RsUserFriendObj1("qq")
  92. StrMSN = RsUserFriendObj1("MSN")
  93. StrContent =  RsUserFriendObj1("Content")
  94. strFriendType = RsUserFriendObj1("FriendType")
  95. RsUserFriendObj1.close
  96. set RsUserFriendObj1 = nothing
  97. Else
  98. if Request.QueryString("type") =1 then
  99. strFriendType = 1
  100. Elseif Request.QueryString("type") =2 then
  101. strFriendType = 2
  102. Else
  103. strFriendType = 0
  104. strFriendType_1 = request.QueryString("UserName")
  105. End if
  106. If Trim(Request.QueryString("action"))="addFriend" then
  107. Returvaluestr_1 = Fs_User.GetFriendName(request.QueryString("ToUserNumber"))
  108. End if
  109. End if
  110. %>
  111. <html xmlns="http://www.w3.org/1999/xhtml">
  112. <title>添加/修改朋友-网站内容管理系统</title>
  113. <meta name="keywords" content="风讯cms,cms,FoosunCMS,FoosunOA,FoosunVif,vif,风讯网站内容管理系统">
  114. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  115. <meta content="MSHTML 6.00.3790.2491" name="GENERATOR" />
  116. <meta name="Keywords" content="Foosun,FoosunCMS,Foosun Inc.,风讯,风讯网站内容管理系统,风讯系统,风讯新闻系统,风讯商城,风讯b2c,新闻系统,CMS,域名空间,asp,jsp,asp.net,SQL,SQL SERVER" />
  117. <link href="images/skin/Css_<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>/<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  118. <head>
  119. <body>
  120. <table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" class="table">
  121.   <tr>
  122.     <td>
  123.       <!--#include file="top.asp" -->
  124.     </td>
  125.   </tr>
  126. </table>
  127. <table width="98%" height="135" border="0" align="center" cellpadding="1" cellspacing="1" class="table">
  128.   
  129.     <tr class="back"> 
  130.       <td   colspan="2" class="xingmu" height="26"> <!--#include file="Top_navi.asp" --> </td>
  131.     </tr>
  132.     <tr class="back"> 
  133.       <td width="18%" valign="top" class="hback"> <div align="left"> 
  134.           <!--#include file="menu.asp" -->
  135.         </div></td>
  136.       <td width="82%" valign="top" class="hback"><table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  137.           <tr class="hback"> 
  138.             
  139.           <td class="hback"><strong>位置:</strong><a href="../">网站首页</a> &gt;&gt; 
  140.             <a href="main.asp">会员首页</a> &gt;&gt; <a href="Friend.asp">朋友管理</a> &gt;&gt;  添加/修改朋友</td>
  141.           </tr>
  142.         </table>
  143.         
  144.       
  145.         
  146.       <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  147.         <form name="UserForm" method="post" action="" onSubmit="return CheckForm();">
  148.           <tr class="hback"> 
  149.             <td width="11%" class="hback_1"><div align="center" class="tx">* 用户名</div></td>
  150.             <td width="30%" class="hback"><div align="left"> 
  151.                 <input name="UserName" type="text" id="UserName" value="<% = Returvaluestr_1 %><% = strFriendType_1%>" size="30" <%if Request.QueryString("FriendID")<>"" then Response.Write("ReadOnly")%>>
  152.               </div></td>
  153.             <td width="59%" class="hback"><div align="left"> </div></td>
  154.           </tr>
  155.           <tr class="hback"> 
  156.             <td colspan="3" class="xingmu"><div align="left">备注部分</div></td>
  157.           </tr>
  158.           <tr class="hback"> 
  159.             <td class="hback_1"><div align="center"  class="tx">*姓名</div></td>
  160.             <td class="hback"><input name="RealName" type="text" id="RealName" value="<% = StrRealName %>" size="30" maxlength="20"></td>
  161.             <td class="hback">好友的备注名字</td> 
  162.           </tr> 
  163.           <tr class="hback"> 
  164.             <td class="hback_1"><div align="center">电子邮件</div></td> 
  165.             <td class="hback">
  166. <input name="Email" type="text" id="Email" value="<% = StrEmail%>" size="30" maxlength="150"></td>
  167.             <td class="hback">好友的备注电子邮件</td> 
  168.           </tr> 
  169.           <tr class="hback"> 
  170.             <td class="hback_1"><div align="center">电话</div></td>
  171.             <td class="hback">
  172. <input name="Tel" type="text" id="Tel" value="<% = StrTel%>" size="30" maxlength="24"></td>
  173.             <td class="hback">好友的备注电话</td>
  174.           </tr>
  175.           <tr class="hback"> 
  176.             <td class="hback_1"><div align="center">手机</div></td>
  177.             <td class="hback">
  178. <input name="mobile" type="text" id="mobile" value="<% = Strmobile%>" size="30" maxlength="24"></td>
  179.             <td class="hback">好友的备注手机</td>
  180.           </tr>
  181.           <tr class="hback"> 
  182.             <td class="hback_1"><div align="center">QQ</div></td>
  183.             <td class="hback">
  184. <input name="qq" type="text" id="qq" value="<% = StrQQ%>" size="30" maxlength="25"></td>
  185.             <td class="hback">好友的备注QQ</td>
  186.           </tr>
  187.           <tr class="hback"> 
  188.             <td class="hback_1"><div align="center">MSN</div></td>
  189.             <td class="hback">
  190. <input name="MSN" type="text" id="MSN" value="<% = StrMSN%>" size="30" maxlength="150"></td>
  191.             <td class="hback">好友的备注MSN</td>
  192.           </tr>
  193.           <tr class="hback"> 
  194.             <td class="hback_1"><div align="center">备注</div></td>
  195.             <td class="hback">
  196. <textarea name="Content" cols="30" rows="5" id="Content"><% = StrContent%></textarea></td>
  197.             <td class="hback">好友的备注,最大200字符</td>
  198.           </tr>
  199.           <tr class="hback"> 
  200.             <td class="hback_1"><div align="center">类型</div></td>
  201.             <td colspan="2" class="hback">
  202. <select name="FriendType" id="FriendType">
  203.                 <option value="0" <%if strFriendType = 0 then response.Write("selected")%>>好朋友</option>
  204.                 <option value="1" <%if strFriendType= 1 then response.Write("selected")%>>陌生人</option>
  205.                 <option value="2" <%if strFriendType = 2 then response.Write("selected")%>>黑名单</option>
  206.               </select></td>
  207.           </tr>
  208.           <tr class="hback"> 
  209.             <td class="hback_1">&nbsp;</td>
  210.             <td colspan="2" class="hback">
  211. <input type="submit" name="Submit" value="提交好友资料"> 
  212.               <input name="Action" type="hidden" id="Action" value="Save">
  213.               <input name="Id" type="hidden" id="Id" value="<%=Trim(Request.QueryString("FriendID"))%>"></td>
  214.           </tr>
  215.         </form>
  216.       </table>
  217.        </td>
  218.     </tr>
  219.     <tr class="back"> 
  220.       <td height="20"  colspan="2" class="xingmu"> <div align="left"> 
  221.           <!--#include file="Copyright.asp" -->
  222.         </div></td>
  223.     </tr>
  224.  
  225. </table>
  226. </body>
  227. </html>
  228. <%
  229. Set Fs_User = Nothing
  230. %>
  231. <script language="JavaScript" type="text/javascript">
  232. function CheckForm()
  233. {
  234. if(document.UserForm.UserName.value=="")
  235. {
  236. alert("请填写用户名!");
  237. document.UserForm.UserName.focus();
  238. return false;
  239. }
  240. if(document.UserForm.RealName.value=="")
  241. {
  242. alert("请填写备注姓名!");
  243. document.UserForm.RealName.focus();
  244. return false;
  245. }
  246. }
  247. </script>
  248. <!--Powsered by Foosun Inc.,Product:FoosunCMS V4.0系列-->