u_modifypsw.asp
上传用户:comthink
上传日期:2021-05-06
资源大小:1280k
文件大小:5k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

HTML/CSS

  1. <!--#include file="conn.asp"-->
  2. <!-- #include file="inc/const.asp" -->
  3. <!--#include file="md5.asp"-->
  4. <!--#include file="inc/chkinput.asp"-->
  5. <%
  6. '=========================================================
  7. ' File: u_modifypsw.asp
  8. ' Version:5.0
  9. ' Date: 2003-8-12
  10. ' Script Written by Leibo
  11. '=========================================================
  12. ' Copyright (C) 2003,2004 Mathren.com. All rights reserved.
  13. ' Web: http://www.mathren.com
  14. ' Email: webmaster@mathren.com
  15. '=========================================================
  16. response.buffer=true
  17. stats="修改密码"
  18. dim psw
  19. dim oldpassword
  20. if not founduser then
  21. Errmsg=Errmsg+"<br>"+"<li>您还没有登陆,请登陆后进行修改。"
  22. founderr=true
  23. end if
  24. call head()
  25. if founderr then
  26.    errmsg=errmsg+"<br>"+"<li>您没有<a href=login.asp target=_blank>登录</a>。"
  27. call head_var("","")
  28. call txl_error()
  29. else
  30. call head_var("个人菜单","u_index.asp")
  31. if request("action")="update" then
  32. call update()
  33. if founderr then
  34. call txl_error()
  35. else
  36. sucmsg="<li>修改密码成功!"
  37. call txl_suc()
  38. end if
  39. else
  40. call userinfo()
  41. end if
  42. end if
  43. call foot()
  44. sub userinfo()
  45. set rs=server.createobject("adodb.recordset")
  46. sql="Select * from [User] where userid="&userid
  47. rs.open sql,conn,1,1
  48. if rs.eof and rs.bof then
  49. errmsg=errmsg+"<br>"+"<li>该用户名不存在。"
  50. founderr=true
  51. exit sub
  52. end if
  53. %>
  54. <table width="<%=txl_body(0)%>" cellpadding="0" cellspacing="0" align="center" style="border:1px <%=txl_body(9)%> solid; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 0px; border-left-width: 1px;">  
  55. <tr> 
  56. <td bgcolor=<%=txl_body(10)%> align="center" valign="top"><br>
  57. <table cellpaddin=3 cellspacing=1 class=tableborder1 width=<%=txl_body(19)%> align=center>
  58. <tr>
  59. <th width=14% height=25 id=tabletitlelink><a href=u_index.asp>个人菜单首页</a></th>
  60. <th width=14% id=tabletitlelink><a href=u_modifymy.asp>基本资料修改</a></th>
  61. <th width=14% id=tabletitlelink><a href=u_modifypsw.asp>用户密码修改</a></th>
  62. <th width=14% id=tabletitlelink><a href=u_modifyadd.asp>联系资料修改</a></th>
  63. <th width=14% id=tabletitlelink><a href=u_myskin.asp>选择界面风格</a></th>
  64. <th width=14% id=tabletitlelink><a href=usersms.asp>我的短信管理</a></th>
  65. <th width=14% id=tabletitlelink><a href=d_index.asp>我的日记管理</a></th>
  66. </tr>
  67. </table>
  68. <br>
  69. <table cellpadding=5 cellspacing=1 border=0 class=tableborder1 width=<%=txl_body(19)%> align=center>
  70. <form action="u_modifypsw.asp?action=update&username=<%=htmlencode(membername)%>" method=POST name="theForm">
  71. <tr>
  72. <th height=25 colspan=2>用户密码修改</td>
  73. </tr>
  74. <tr>    
  75. <td width="40%" class=tablebody1><B>旧密码确认</B>:<BR>只有先输入旧密码才能进行修改</td>   
  76. <td width="60%" class=tablebody1>    <input type="password" name="oldpsw" value="" size=30 maxlength=13>   </td>   
  77. </tr>  
  78. <tr>    
  79. <td width="40%" class=tablebody1><B>新密码确认</B>:<BR>如要修改请直接输入新密码进入更新</td>   
  80. <td width="60%" class=tablebody1>    <input type="password" name="psw" value="" size=30 maxlength=13>   </td>   
  81. </tr> 
  82. <tr>    
  83. <td width="40%" class=tablebody1><B>密码问题</B>:<BR>请填写做为密码答案依据</td>   
  84. <td width="60%" class=tablebody1>    <input type=text name="question" size=30 value="<%=htmlencode(rs("question"))%>"></td>   
  85. </tr> 
  86. <tr>    
  87. <td width="40%" class=tablebody1><B>问题答案</B>:<BR>请认真填写以便您日后取回密码<BR>答案采用了MD5加密,只供取回密码使用,如要修改可直接填写。</td>   
  88. <td width="60%" class=tablebody1>    <input type=text name="answer" size=30 value="<%=htmlencode(rs("answer"))%>"><input type=hidden name="oldanswer" value="<%=htmlencode(rs("answer"))%>"></td>   
  89. </tr>
  90. <tr> 
  91. <td colspan="2" width="100%"  class=tablebody2 align="center"><input type=Submit value="更 新" name="Submit"> &nbsp; <input type="reset" name="Submit2" value="清 除"></td>
  92. </tr>
  93. </form>
  94. </table><br>
  95. </td>
  96. </tr>
  97. </table>
  98. <%
  99. rs.close
  100. set rs=nothing
  101. end sub
  102. sub update()
  103. set rs=server.createobject("adodb.recordset")
  104. sql="Select password from [User] where userid="&userid
  105. set rs=conn.execute(sql)
  106. if rs.eof and rs.bof then
  107. errmsg=errmsg+"<br>"+"<li>该用户名不存在。"
  108. founderr=true
  109. exit sub
  110. else
  111. if request("oldpsw")="" then
  112.    errmsg=errmsg+"<br>"+"<li>请输入您的旧密码,才能完成修改。"
  113. founderr=true
  114. exit sub
  115. elseif md5(trim(request("oldpsw")))<>trim(rs("password")) then
  116.    errmsg=errmsg+"<br>"+"<li>输入的旧密码错误,请重新输入。"
  117. founderr=true
  118. exit sub
  119. else
  120. oldpassword=request("oldpsw")
  121. end if
  122. if request("psw")<>"" then
  123. password=md5(request("psw"))
  124. else
  125. password=rs("password")
  126. end if
  127. if request("question")="" then
  128.    errmsg=errmsg+"<br>"+"<li>请输入密码提示问题。"
  129. founderr=true
  130. exit sub
  131. else
  132. question=request("question")
  133. end if
  134. if request("answer")="" then
  135.    errmsg=errmsg+"<br>"+"<li>请输入密码提示问题答案。"
  136. founderr=true
  137. exit sub
  138. elseif request("answer")=request("oldanswer") then
  139. answer=request("answer")
  140. else
  141. answer=md5(request("answer"))
  142. end if
  143. end if
  144. set rs=server.createobject("adodb.recordset")
  145. sql="Select * from [User] where userid="&userid
  146. rs.open sql,conn,1,3
  147. if rs.eof and rs.bof then
  148. errmsg=errmsg+"<br>"+"<li>该用户名不存在。"
  149. founderr=true
  150. exit sub
  151. else
  152. rs("password")=password
  153. rs("question")=question
  154. rs("answer")=answer
  155. rs.Update
  156. Response.Cookies("mathren")("password") = password
  157. Response.Cookies("mathren").path=cookiepath
  158. end if
  159. rs.close
  160. set rs=nothing
  161. end sub
  162. %>