umdfydo.asp

来自「ASP入门与提高实用教程 源文件(上传网站)」· ASP 代码 · 共 58 行

ASP
58
字号
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/const.asp"-->
<!--#include file="../inc/md5.asp"-->
<%
dim password0,password1,password2
dim foundErr
dim rs,exec1
foundErr=false

password0=encodestr(Request.form("password0"))
password1=encodestr(Request.form("password1"))
password2=encodestr(Request.form("password2"))
session("error")=""

if password1<>password2 then
	session("error")="两次输入新密码不一致!!<br>"
	foundErr=true
end if
if len(password1)<6  then
	session("error")=session("error") & "密码至少为6位!!<br>"
	foundErr=true
end if

set rs=conn.execute("select * from users where username='"&session("admin")&"' and password='"&md5(password0)&"'")

if rs.eof then
	session("error")=session("error") & "旧密码错误!!<br>"
	foundErr=true
end if
rs.close
if foundErr then
	connclose()
	response.redirect("error.asp")
end if
exec1="select password from [users] where username='"&session("admin")&"'"
rs.open exec1,conn,1,2
rs("password")=md5(password1)
rs.update
rsclose()
connclose()
%>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="142">&nbsp;</td>
    <td width="224">提交成功!</td>
    <td width="134">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><a href="main.asp">返回管理页</a></td>
    <td>&nbsp;</td>
  </tr>
</table>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?