GetPassword.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="../FS_Inc/Md5.asp" -->
  6. <!--#include file="lib/strlib.asp" -->
  7. <%
  8. User_GetParm
  9. response.Cookies("FoosunUserCookies")("UserLogin_Style_Num")  = p_LoginStyle
  10. If p_LoginStyle="" Or p_LoginStyle = 0 then
  11. Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num") = "1"
  12. End if
  13. %>
  14. <html xmlns="http://www.w3.org/1999/xhtml">
  15. <title>找回密码--会员登陆</title>
  16. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  17. <meta content="MSHTML 6.00.3790.2491" name="GENERATOR" />
  18. <meta name="keywords" content="风讯,风讯cms,cms,FoosunCMS,FoosunOA,FoosunVif,vif,风讯网站内容管理系统">
  19. <link href="images/skin/Css_<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>/<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  20. <head>
  21. <body oncontextmenu="//return false;">
  22. <%
  23. If Request.Form("Action")  = "step1" then
  24. Call step1()
  25. ElseIf Request.Form("Action")  = "step2" then
  26. Call step2()
  27. ElseIf Request.Form("Action")  = "step3" then
  28. Call step3()
  29. Else
  30.    Call Main()
  31. End if
  32. %>
  33. <%Sub main()%>
  34. <table width="90%" height="145" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
  35.   <form action=""  method="post" name="myform" id="myform" >
  36.     <tr class="back"> 
  37.       <td   colspan="2" class="xingmu" height="24">找回密码第一步</td>
  38.     </tr>
  39.     <tr class="back"> 
  40.       <td width="23%" height="72" class="hback"> <div align="right">用户名 </div></td>
  41.       <td width="77%" class="hback"><input name="UserName" type="text" id="UserName" style="width:160px"  /> 
  42.         <input class="button" type="submit" value="找回密码第一步" name="Submit" /> <input name="Action" type="hidden" id="Action" value="step1"> 
  43.       </td>
  44.     </tr>
  45.     <tr class="back"> 
  46.       <td height="26"  colspan="2" class="xingmu"> <div align="left"> 
  47.           <table width="100%" border="0" cellspacing="0" cellpadding="0">
  48.             <tr> 
  49.               <td width="53%" class="xingmu"  height="24">FoosunCMS<%=p_Soft_Version %></td>
  50.               <td width="47%" class="xingmu"  height="24">Powered by <a href="http://www.foosun.net" target="_blank" title="风讯CMS---网站内容管理专家,Www.foosun.cn">Foosun 
  51.                 Inc.</a></td>
  52.             </tr>
  53.           </table>
  54.         </div></td>
  55.     </tr>
  56.   </form>
  57. </table>
  58. <%End Sub%>
  59. <%
  60. Sub step1()
  61. Dim p_UserName,RsStep1Obj
  62. p_UserName = NoSqlHack(Replace(Trim(Request.Form("UserName")),"''",""))
  63. if p_UserName = "" then
  64. strShowErr = "<li>请填写用户名</li>"
  65. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=../GetPassword.asp")
  66. Response.end
  67. End if
  68. Set RsStep1Obj = server.CreateObject(G_FS_RS)
  69. RsStep1Obj.open "select  UserName,UserID,PassQuestion From FS_ME_Users where UserName = '"& p_UserName &"'",User_Conn,1,1
  70. if RsStep1Obj.eof then
  71. strShowErr = "<li>不存在此用户名</li>"
  72. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=../GetPassword.asp")
  73. Response.end
  74. Else
  75. %>
  76. <table width="90%" height="195" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
  77.   <form action=""  method="post" name="myform" id="myform" >
  78.     <tr class="back"> 
  79.       <td   colspan="2" class="xingmu" height="24">找回密码第二步</td>
  80.     </tr>
  81.     <tr class="back"> 
  82.       <td height="25" class="hback"> <div align="right">您的密码问题:</div></td>
  83.       <td class="hback"><input name="PassQuestion" type="text" id="PassQuestion" style="width:160px" value="<% = RsStep1Obj("PassQuestion")%>" readonly /></td>
  84.     </tr>
  85.     <tr class="back"> 
  86.       <td height="27" class="hback"> <div align="right">填写您的密码答案</div></td>
  87.       <td class="hback"><input name="PassAnswer" type="password" id="PassAnswer" style="width:160px" /></td>
  88.     </tr>
  89.     <tr class="back"> 
  90.       <td height="31" class="hback"> <div align="right">安全码</div></td>
  91.       <td class="hback"><input name="safeCode" type="password" id="safeCode" style="width:160px"/></td>
  92.     </tr>
  93.     <tr class="back">
  94.       <td height="27" class="hback"><div align="right">您的电子邮件</div></td>
  95.       <td class="hback"><input name="Email" type="text" id="Email" style="width:160px"/>
  96.         必须填写</td>
  97.     </tr>
  98.     <tr class="back"> 
  99.       <td width="23%" height="27" class="hback"> <div align="right"></div></td>
  100.       <td width="77%" class="hback"> <input class="button" type="submit" value="找回密码第二步" name="Submit2" /> 
  101.         <input name="Action" type="hidden" id="Action" value="step2">
  102.         <input name="UserName" type="hidden" id="UserName" value="<% = RsStep1Obj("UserName")%>">
  103.         <span class="tx"> 说明,密码答案和安全码任意填写一项即可</span></td>
  104.     </tr>
  105.     <tr class="back"> 
  106.       <td height="26"  colspan="2" class="xingmu"> <div align="left"> 
  107.           <table width="100%" border="0" cellspacing="0" cellpadding="0">
  108.             <tr> 
  109.               <td width="53%" class="xingmu"  height="24">FoosunCMS<%=p_Soft_Version %></td>
  110.               <td width="47%" class="xingmu"  height="24">Powered by <a href="http://www.foosun.net" target="_blank" title="风讯CMS---网站内容管理专家,Www.foosun.cn">Foosun 
  111.                 Inc.</a></td>
  112.             </tr>
  113.           </table>
  114.         </div></td>
  115.     </tr>
  116.   </form>
  117. </table>
  118. <%
  119. End if
  120. RsStep1Obj.close
  121. set RsStep1Obj = nothing
  122. End Sub
  123. %>
  124. <%Sub step2()
  125. Dim p_UserName_str,RsStep2Obj,p_PassAnswer,p_safeCode,p_Email,SQL
  126. p_UserName_str = NoSqlHack(Replace(Trim(Request.Form("UserName")),"''",""))
  127. p_PassAnswer = NoSqlHack(Replace(Trim(Request.Form("PassAnswer")),"''",""))
  128. p_safeCode = NoSqlHack(Replace(Trim(Request.Form("safeCode")),"''",""))
  129. p_Email = NoSqlHack(Replace(Trim(Request.Form("Email")),"''","")) 
  130. if p_PassAnswer = "" and p_safeCode = "" then
  131. strShowErr = "<li>密码答案或者密码必须填写一项</li>"
  132. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  133. Response.end
  134. End if
  135. if p_Email = ""  then
  136. strShowErr = "<li>请填写电子邮件</li>"
  137. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  138. Response.end
  139. End if
  140. Set RsStep2Obj = server.CreateObject(G_FS_RS)
  141. if p_PassAnswer <>"" then
  142. SQL = "select  PassAnswer,safeCode,UserName,UserID,PassQuestion,Email From FS_ME_Users where UserName = '"& p_UserName_str &"' and PassAnswer = '"& md5(p_PassAnswer,16)  &"' and Email='"& p_Email &"'"
  143. Else
  144. SQL =  "select  PassAnswer,safeCode,UserName,UserID,PassQuestion,Email From FS_ME_Users where UserName = '"& p_UserName_str &"' and safeCode = '"& md5(p_safeCode,16)  &"'  and Email='"& p_Email &"'"
  145. End if
  146. 'Response.Write(SQL)
  147. 'Response.end
  148. RsStep2Obj.open SQL,User_Conn,1,1
  149. if RsStep2Obj.eof then
  150. strShowErr = "<li>找不到记录,请确认您输入正确</li>"
  151. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  152. Response.end
  153. Else
  154. %>
  155. <table width="90%" height="137" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
  156.   <form action=""  method="post" name="myform" id="myform" >
  157.     <tr class="back"> 
  158.       <td   colspan="2" class="xingmu" height="24">修改密码</td>
  159.     </tr>
  160.     <tr class="back">
  161.       <td height="38" class="hback"> 
  162.         <div align="right">请输入您的新密码</div></td>
  163.       <td class="hback"><input name="pass_new" type="password" id="pass_new" style="width:160px"  />
  164.         <input type="hidden" name="UserName" value="<% = p_UserName_str %>">
  165.         <input type="hidden" name="Email" value="<% = p_Email %>"></td>
  166.     </tr>
  167.     <tr class="back"> 
  168.       <td width="23%" height="42" class="hback"> 
  169.         <div align="right">请输入您的新密码</div></td>
  170.       <td width="77%" class="hback"><input name="confim_pass_new" type="password" id="confim_pass_new" style="width:160px"  /> 
  171.         <input class="button" type="submit" value="找回密码" name="Submit3" /> 
  172.         <input name="Action" type="hidden" id="Action" value="step3"> </td>
  173.     </tr>
  174.     <tr class="back"> 
  175.       <td height="26"  colspan="2" class="xingmu"> <div align="left"> 
  176.           <table width="100%" border="0" cellspacing="0" cellpadding="0">
  177.             <tr> 
  178.               <td width="53%" class="xingmu"  height="24">FoosunCMS<%=p_Soft_Version %></td>
  179.               <td width="47%" class="xingmu"  height="24">Powered by <a href="http://www.foosun.net" target="_blank" title="风讯CMS---网站内容管理专家,Www.foosun.cn">Foosun 
  180.                 Inc.</a></td>
  181.             </tr>
  182.           </table>
  183.         </div></td>
  184.     </tr>
  185.   </form>
  186. </table>
  187. <%
  188. End if
  189.  RsStep2Obj.close
  190.  set RsStep2Obj = nothing
  191. End Sub%>
  192. <%
  193. Sub step3()
  194. Dim p_pass_new,p_confim_pass_new
  195. p_pass_new = md5(Request.Form("pass_new"),16)
  196. p_confim_pass_new = md5(Request.Form("confim_pass_new"),16)
  197. if Trim(Replace(Request.Form("pass_new"),"''","")) = ""  then
  198. strShowErr = "<li>请填写您的密码</li>"
  199. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  200. Response.end
  201. End if
  202. if Trim(Replace(Request.Form("pass_new"),"''","")) <> Trim(Replace(Request.Form("confim_pass_new"),"''",""))  then
  203. strShowErr = "<li>2次密码不一致</li>"
  204. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  205. Response.end
  206. End if
  207. User_Conn.execute("Update FS_ME_Users set UserPassword ='"& p_pass_new &"' where UserName = '"& NoSqlHack(Replace(Trim(Request.Form("UserName")),"''",""))&"' and Email = '"& NoSqlHack(Replace(Trim(Request.Form("Email")),"''",""))&"'")
  208. strShowErr = "<li>修改成功,请到登陆口登陆</li>"
  209. Response.Redirect("lib/Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=../login.asp")
  210. Response.end
  211. End Sub
  212. %>
  213. </body>
  214. </html>
  215. <!--Powsered by Foosun Inc.,Product:FoosunCMS V4.0系列-->
  216. <script language="JavaScript" type="text/javascript">
  217. function SetFocus()
  218. {
  219. if (document.myform.name.value=="")
  220. document.myform.name.focus();
  221. else
  222. document.myform.name.select();
  223. }
  224. function CheckForm()
  225. {
  226. if(document.myform.name.value=="")
  227. {
  228. alert("请输入您的用户名!");
  229. document.myform.name.focus();
  230. return false;
  231. }
  232. if(document.myform.password.value == "")
  233. {
  234. alert("请输入您的密码!");
  235. document.myform.password.focus();
  236. return false;
  237. }
  238. }
  239. </script>