📄 getpass.asp
字号:
<!--#include file="config.asp"-->
<!--#include file="inc/md5.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>取回密码</title>
<link href="css/user.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="98%" border="0" align="center" cellpadding="6" cellspacing="0" class="a2">
<tr>
<td class="a1">取回密码</td>
</tr>
<tr>
<td><%
dim action
action=request("action")
if action="step2" then
dim username,email
username=htmlencode2(Request.Form("username"))
email=htmlencode2(Request.Form("email"))
if username="" or email="" then
call mb("用户名或E-mail均不能为空!","",0)
end if
set rs=server.createobject("adodb.recordset")
sql="select * from [user] where username='"&username&"' and email='"&email&"' and state=1"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
call mb("对不起,发生错误:\n\n1.用户名或E-mail错误\n\n2.用户帐号还未开通或被锁定!","",0)
else
%>
<table width="99%" border="0" align="center" cellpadding="6" cellspacing="0">
<form action="?action=step3" method="post" name="getpassword" id="getpassword">
<tr bgcolor="#FFFFFF">
<td height="25" colspan="2">第二步:回答问题 </td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="34%" height="25" align="right">密码提示问题:</td>
<td width="66%" height="25"><b><%=rs("question")%></b></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25" align="right">答案:</td>
<td height="25"><input name="answer" type="text" id="answer2" size="25">
*</td>
</tr>
<tr align="center" bgcolor="#FFFFFF">
<td height="30" colspan="2"><input name="username" type="hidden" id="username3" value="<%=username%>">
<input name="Submit" type="button" id="Submit" onClick="javascript:history.go(-1);"
value="上一步">
<input name="Submit" type="submit" id="Submit" value="下一步"></td>
</tr>
</form>
</table>
<%
end if
rs.close
set rs=nothing
elseif action="step3" then
dim answer
username=htmlencode2(Request.Form("username"))
answer=request.form("answer")
if username="" then
call mb("对不起,请指定要取回密码的用户名!","getpass.asp",1)
end if
if answer="" then
call mb("请输入密码提示问题的答案!","",0)
end if
set rs=conn.execute("select * from [user] where username='"&username&"'")
if rs.bof and rs.eof then
call mb("对不起,找不到此用户名!","getpass.asp","")
elseif rs("answer")<>md5(answer,32) then
call mb("对不起,密码答案不正确!","",0)
else
randomize
newpassword=left(rnd*10000000000,8)
set rsn=server.createobject("adodb.recordset")
sqln="select * from [user] where username='"&username&"'"
rsn.open sqln,conn,1,3
rsn("password")=md5(newpassword,32)
rsn.update
rsn.close
%>
<table width="99%" border="0" align="center" cellpadding="6" cellspacing="0">
<tr>
<td colspan="2" bgcolor="#FFFFFF">第三步:生成新密码</td>
</tr>
<tr>
<td height="91" colspan="2" align="center" bgcolor="#FFFFFF">您好,系统已经将您的密码重设为:<font color="red"><b><%=newpassword%></b></font>,请立即使用新的密码[<a
href="login.asp" target="_blank">登录</a>]并重新修改!</td>
</tr>
</table>
<%
end if
rs.close
set rs=nothing
else
%>
<table width="99%" border="0" align="center" cellpadding="6" cellspacing="0">
<form action="?action=step2" method="post" name="getpassword" id="getpassword">
<tr bgcolor="#FFFFFF">
<td height="22" colspan="2" bgcolor="#FFFFFF">第一步:请输入您的用户名和E-mail:</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="22" align="right" bgcolor="#FFFFFF">用户名:</td>
<td height="22"><input name="username" type="text" id="username" size="18">
*</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="34%" height="22" align="right" bgcolor="#FFFFFF">E-mail:</td>
<td width="66%" height="22"><input name="email" type="text" size="25">
*</td>
</tr>
<tr align="center" bgcolor="#FFFFFF">
<td height="30" colspan="2"><input name="Submit" type="submit" value="下一步"></td>
</tr>
</form>
</table>
<%
end if
%></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -