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

数据库编程

开发平台:

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="../../FS_Inc/Md5.asp" -->
  7. <%'Copyright (c) 2006 Foosun Inc. Code by awen
  8. 'on error resume next
  9. Dim UserNumber
  10. Dim Str_BaseData_List,Str_OtherData_List,strUserNumberRule 
  11. Dim Fs_User
  12. MF_Default_Conn
  13. MF_User_Conn
  14. MF_Session_TF
  15. Set Fs_User = New Cls_User
  16. '***************************************
  17. Function CheckPostinput()
  18. Dim server_v1, server_v2
  19. CheckPostinput = False
  20. server_v1 = CStr(Request.ServerVariables("HTTP_REFERER"))
  21. server_v2 = CStr(Request.ServerVariables("SERVER_NAME"))
  22. If Mid(server_v1, 8, Len(server_v2)) = server_v2 Then
  23. CheckPostinput = True
  24. End If
  25. End Function
  26. Function CheckCF(FildName,FildValue,Str_LinkStr)
  27. '判断重复 Str_LinkStr = ' # ""
  28. CheckCF = User_Conn.execute("select count(*) from FS_ME_Users where "&FildName&"="&Str_LinkStr& FildValue &Str_LinkStr)(0)
  29. if err.number>0 then
  30. Response.Redirect("lib/error.asp?ErrCodes="&server.URLEncode(err.description))
  31. Response.End()
  32. end if
  33. End Function
  34. If CheckPostinput = False Then
  35. Response.Redirect("lib/Error.asp?ErrCodes=<li>参数错误</li><li> 不要从外部提交数据</li>&ErrorUrl=../User_manage.asp")
  36. Response.end
  37. End If
  38. Function GetPwdByUserNumber(UserNumber)
  39. if UserNumber<>"" then 
  40. GetPwdByUserNumber = User_Conn.execute("select UserPassword from FS_ME_Users where UserNumber = '"&UserNumber&"'")(0)
  41. else
  42. GetPwdByUserNumber = ""
  43. end if
  44. if err.number>0 then
  45. err.clear : GetPwdByUserNumber = ""
  46. end if
  47. End Function
  48. Str_BaseData_List = "UserName,UserPassword,PassQuestion,PassAnswer,SafeCode,Email"
  49. Str_OtherData_List = "NickName,RealName,Sex,BothYear,Certificate,CerTificateCode,Province,City" _
  50. &",HeadPic,HeadPicSize,tel,Mobile,isMessage,HomePage,QQ,MSN,Address,PostCode,Vocation,Integral,FS_Money" _
  51. &",TempLastLoginTime,TempLastLoginTime_1,CloseTime,IsMarray,SelfIntro,isOpen,GroupID,isLock,UserFavor,OnlyLogin"
  52. select case Request.QueryString("Act")
  53. case "BaseData"
  54. UserNumber = NoSqlHack(trim(request.Form("frm_UserNumber_Edit1")))
  55. call save(Str_BaseData_List,1)
  56. case "OtherData"
  57. UserNumber = NoSqlHack(trim(request.Form("frm_UserNumber_Edit2")))
  58. if UserNumber="" then 
  59. Response.Redirect("lib/error.asp?ErrCodes=<li>修改时必要参数必须填写。</li>")
  60. response.End()
  61. end if
  62. call save(Str_OtherData_List,0)
  63. case "Add_AllData"
  64. UserNumber = NoSqlHack(trim(request.Form("frm_UserNumber_Edit2")))
  65. call save(Str_BaseData_List &","& Str_OtherData_List,1)
  66. case "Del"
  67. Del
  68. end select 
  69. Sub Del()
  70. Dim Str_Tmp,Arr_Tmp,s_StrPWD_
  71. if request.QueryString("UserNumber")<>"" then 
  72. Str_Tmp = NoSqlHack(Trim(request.QueryString("UserNumber")))
  73. else
  74. Str_Tmp = request.Form("frm_UserNumber")
  75. end if
  76. if Str_Tmp="" then Response.Redirect("lib/error.asp?ErrCodes=<li>你必须至少选择一个进行删除。</li>")
  77. Str_Tmp = replace(Str_Tmp," ","")
  78. Arr_Tmp = split(Str_Tmp,",")
  79. strShowErr = ""
  80. on error resume next
  81. for each Str_Tmp in Arr_Tmp
  82. s_StrPWD_ = GetPwdByUserNumber(Str_Tmp)
  83. if s_StrPWD_<>"" then 
  84. Call Fs_User.DelUser(Str_Tmp,s_StrPWD_)
  85. else
  86. strShowErr = strShowErr & "<li>用户"&Str_Tmp&"未删除,可能该用户已不存在……。</li>"
  87. end if
  88. next
  89. if strShowErr<>"" then strShowErr = "<li>以下是删除失败的描述:</li>"&strShowErr
  90. Response.Redirect("lib/Success.asp?ErrorUrl=../User_manage.asp&ErrCodes=<li>恭喜,删除成功。</li>"&strShowErr)
  91. End Sub
  92. Sub Save(Str_Tmp,Bit_IsNull)
  93. Dim Arr_Tmp,UserSql
  94. Arr_Tmp = split(Str_Tmp,",")
  95. UserSql = "select UserNumber,IsCorporation,RegTime,myskin, "&Str_Tmp&" from FS_ME_Users where UserNumber= '"&UserNumber&"'"
  96. Set UpdateUserRs = CreateObject(G_FS_RS)
  97. UpdateUserRs.Open UserSql,User_Conn,3,3
  98. if UserNumber<>"" and not UpdateUserRs.eof then 
  99. ''修改   
  100. UpdateUserRs("IsCorporation") = 0
  101. for each Str_Tmp in Arr_Tmp
  102. if Bit_IsNull = 1 then 
  103. if request.Form("frm_"&Str_Tmp)<>"" then 
  104. if instr(",UserPassword,PassQuestion,PassAnswer,SafeCode,",","&Str_Tmp&",")>0 then 
  105. UpdateUserRs(Str_Tmp) = Md5(NoSqlHack(request.Form("frm_"&Str_Tmp)),16)
  106. else
  107. if NoSqlHack(request.Form("frm_"&Str_Tmp))<>"" then 
  108. UpdateUserRs(Str_Tmp) = NoSqlHack(request.Form("frm_"&Str_Tmp))
  109. else
  110. UpdateUserRs(Str_Tmp) = null
  111. end if
  112. end if
  113. end if
  114. else
  115. if NoSqlHack(request.Form("frm_"&Str_Tmp))<>"" then 
  116. UpdateUserRs(Str_Tmp) = NoSqlHack(request.Form("frm_"&Str_Tmp))
  117. else
  118. UpdateUserRs(Str_Tmp) = null
  119. end if
  120. 'response.Write(Str_Tmp&":"&NoSqlHack(request.Form("frm_"&Str_Tmp))&"<br>")
  121. end if
  122. Next
  123. UpdateUserRs("myskin")=2
  124. 'response.End()
  125. UpdateUserRs.update
  126. UpdateUserRs.close
  127. if err.number>0 then
  128. Response.Redirect("lib/error.asp?ErrCodes="&server.URLEncode(err.description))
  129. Response.End()
  130. else
  131. Response.Redirect("lib/success.asp?ErrCodes=<li>恭喜,修改成功。</li>&ErrorUrl="&server.URLEncode("../User_manage.asp?Act=View&Add_Sql=UserNumber='"&UserNumber&"'"))
  132. Response.End()
  133. end if
  134. else
  135. ''新增
  136. 'strUserNumberRule= Fs_User.strUserNumberRule(p_UserNumberRule)
  137. strUserNumberRule = GetRamCode(10)
  138. if CheckCF("UserNumber",strUserNumberRule,"'")>0 then 
  139. Response.Redirect("lib/Error.asp?ErrCodes=<li>用户编号意外重复。请重新提交。</li>")
  140. Response.end
  141. end if
  142. if CheckCF("UserName",NoSqlHack(request.Form("frm_UserName")),"'")>0 then 
  143. Response.Redirect("lib/Error.asp?ErrCodes=<li>用户名重复。请重新提交。</li>")
  144. Response.end
  145. end if
  146. if CheckCF("Email",NoSqlHack(request.Form("frm_Email")),"'")>0 then 
  147. Response.Redirect("lib/Error.asp?ErrCodes=<li>用户名重复。请重新提交。</li>")
  148. Response.end
  149. end if
  150. UpdateUserRs.addnew
  151. UpdateUserRs("UserNumber") = strUserNumberRule
  152. UpdateUserRs("IsCorporation") = 0
  153. UpdateUserRs("RegTime") = now
  154. for each Str_Tmp in Arr_Tmp
  155. if Bit_IsNull = 1 then 
  156. if request.Form("frm_"&Str_Tmp)<>"" then 
  157. if instr(",UserPassword,PassQuestion,PassAnswer,SafeCode,",","&Str_Tmp&",")>0 then 
  158. UpdateUserRs(Str_Tmp) = Md5(NoSqlHack(request.Form("frm_"&Str_Tmp)),16)
  159. else
  160. if NoSqlHack(request.Form("frm_"&Str_Tmp))<>"" then 
  161. UpdateUserRs(Str_Tmp) = NoSqlHack(request.Form("frm_"&Str_Tmp))
  162. else
  163. UpdateUserRs(Str_Tmp) = null
  164. end if
  165. end if
  166. 'response.Write(Str_Tmp&" : "&NoSqlHack(request.Form("frm_"&Str_Tmp))&"<br>" )
  167. end if
  168. else
  169. if NoSqlHack(request.Form("frm_"&Str_Tmp))<>"" then 
  170. UpdateUserRs(Str_Tmp) = NoSqlHack(request.Form("frm_"&Str_Tmp))
  171. else
  172. UpdateUserRs(Str_Tmp) = null
  173. end if
  174. end if
  175. next
  176. 'response.End()
  177.     UpdateUserRs.update   
  178. UpdateUserRs.close
  179. if err.number>0 then
  180. Response.Redirect("lib/error.asp?ErrCodes="&server.URLEncode(err.description))
  181. Response.End()
  182. else
  183. '插入会员参数
  184. call Fs_User.InsertMyPara( strUserNumberRule )
  185. '插入日志
  186. call Fs_User.AddLog("注册",strUserNumberRule,p_NumGetPoint,p_NumGetMoney,"注册获得积分",0)
  187. '给会员发送电子邮件 
  188. Dim str_isSendMail
  189. str_isSendMail=false
  190. Response.Redirect("lib/success.asp?ErrCodes=<li>恭喜,新增成功。</li>&ErrorUrl="&server.URLEncode("../User_manage.asp?Act=View&Add_Sql=UserNumber='"&strUserNumberRule&"'"))
  191. Response.End()
  192. end if
  193. end if
  194. End Sub
  195. ''=========================================================
  196. User_Conn.Close
  197. Set User_Conn=nothing
  198. %>
  199. <!-- Powered by: FoosunCMS4.0系列,Company:Foosun Inc. -->