lookuppass.asp
来自「一个完全仿照阿里巴巴的网站管理系统 本软件没有版权问题」· ASP 代码 · 共 181 行
ASP
181 行
<!--#include file="main.asp"-->
<!--#include file="Inc/SendMail.asp"-->
<!--#include file="inc/md5.asp"-->
<%action=request("action")%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=citytitle%></title>
</head>
<body topmargin="0">
<%SMT_TOP%>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor=#ffffff>
<%if action="passone" then
user=trim(request("user"))
qylx=request("qylx")
'------------------------------检查用户存在-----------------------------
set rs=server.createobject("adodb.recordset")
select case qylx
case 0
rs.open "select * from SMT_yp where SMT_user='"&user&"'",conn,1,1
if rs.eof then
response.write "<script>alert('此用户名不存在或已被关闭,请重新输入!');history.go(-1)</script>"
response.end
else
mail=rs("SMT_mail")
SMT_question=rs("SMT_question")
SMT_answer=rs("SMT_answer")
end if
rs.close
case 1
rs.open "select * from SMT_job_qz where SMT_user='"&user&"'",conn,1,1
if rs.eof then
response.write "<script>alert('此用户名不存在或已被关闭,请重新输入!');history.go(-1)</script>"
response.end
else
mail=rs("SMT_email")
SMT_question=rs("SMT_question")
SMT_answer=rs("SMT_answer")
end if
rs.close
end select
set rs=nothing
'-------------------------------邮件发送新密码--------------------------------------
if SMT_citysendmail(6)=1 and SMT_citysendmail(4)<>"0" then
Randomize timer
NewPass = left(Md5(cint(8999*Rnd+1000)),10)
SMT_citypassmail=replace(SMT_citypassmail,"{$SMT_name}",cityname)
SMT_citypassmail=replace(SMT_citypassmail,"{$SMT_url}",cityurl)
SMT_citypassmail=replace(SMT_citypassmail,"{$SMT_newpass} ",NewPass)
Topic=cityname&"用户找回密码邮件"
select case SMT_citysendmail(4)
case "Jmail"
call Jmail(mail,Topic,SMT_citypassmail)
case "Cdonts"
call Cdonts(mail,Topic,SMT_citypassmail)
case "AspEmail"
call AspEmail(mail,Topic,SMT_citypassmail)
end select
if sendmail="False" then
response.write"<script>alert('找回密码确认邮件发送出错,下面是产生错误的可能原因:\n\n·您没有填定您的联系邮箱有您填定的邮箱有错误,请重新输入\n\n·联系管理员查看邮件发送功能设置');history.go(-1)</script>"
response.end
elseif sendmail="OK" then
select case qylx
case 0
conn.execute("update SMT_yp set SMT_pass='"&Md5(NewPass)&"' where SMT_user='"&user&"'")
case 1
conn.execute("update SMT_job_qz set SMT_pwd='"&Md5(NewPass)&"' where SMT_user='"&user&"'")
end select
response.write"<script>alert('系统已自动发送一封邮件到您的邮箱,请立即查收');window.open('user_login.asp','_self')</script>"
response.end
else
response.write"<script>alert('出现未知错误,请联系管理员');history.go(-1)</script>"
response.end
end if
'-------------------------------直接写入新密码--------------------------------------
else
response.write "<form name=addform method=post action=?action=passsave><input name=user type=hidden value="&user&"><input name=qylx type=hidden value="&qylx&">"&_
"<tr><td height=25 colspan=2>当前位置:<a href=index.asp>首页</a> >> <a href=LookupPass.asp>找回密码</a></td></tr>"&_
"<tr bgcolor=#efefef><td colspan=2 height=25 style=""border-bottom:1px #999999 solid""> <strong>找回密码第二步 >> 填写密码问题或答案</strong></td></tr>"&_
"<tr><td width=""26%"" align=right></td><td width=""74%"" height=350>密码提示问题:<input disabled name=SMT_question type=text size=20 maxlength=30 class=input2 value="&SMT_question&"><br><br>"&_
"密码问题答案:<input name=SMT_answer type=text size=20 maxlength=30 class=input2><br><br>"&_
"输入您的新密码:<input name=SMT_pass type=password size=19 maxlength=16 class=input2><br><br> <input type=submit name=Submit value=""下一步"" class=input1></td></tr>"&_
"</form>"
end if
'======================================
elseif action="passsave" then
user=request("user")
SMT_answer=Md5(request("SMT_answer"))
SMT_Newpass=request("SMT_pass")
qylx=int(request("qylx"))
if SMT_answer="" or user="" or SMT_Newpass="" or qylx="" then
response.write"<script>alert('请填写问题答案及您的新密码!');history.go(-1)</script>"
response.end
end if
if len(SMT_Newpass)<4 or len(SMT_Newpass)>16 then
response.write"<script>alert('新密码输入错误,请重新输入一个 4-16 位的新密码!');history.go(-1)</script>"
response.end
end if
'------------------------------检查用户存在-----------------------------
set rs=server.createobject("adodb.recordset")
select case qylx
case 0
rs.open "select * from SMT_yp where SMT_user='"&user&"' and SMT_answer='"&SMT_answer&"'",conn,1,1
if rs.eof then
response.write "<script>alert('对不起您的密码提示问题答案输入错误,请重新输入!');history.go(-1)</script>"
response.end
else
conn.execute("update SMT_yp set SMT_pass='"&Md5(SMT_Newpass)&"' where SMT_user='"&user&"'")
response.write"<script>alert('密码修改成功,请重新登录!');window.open('user_login.asp','_self')</script>"
response.end
end if
rs.close
case 1
rs.open "select * from SMT_job_qz where SMT_user='"&user&"' and SMT_answer='"&SMT_answer&"'",conn,1,1
if rs.eof then
response.write "<script>alert('对不起您的密码提示问题答案输入错误,请重新输入!');history.go(-1)</script>"
response.end
else
conn.execute("update SMT_job_qz set SMT_pwd='"&Md5(SMT_Newpass)&"' where SMT_user='"&user&"'")
response.write"<script>alert('密码修改成功,请重新登录!');window.open('user_login.asp','_self')</script>"
response.end
end if
rs.close
end select
set rs=nothing
'======================================
else%>
<script language="JavaScript">
<!--
function checkdata() {
if( isNumberString(addform.user.value,"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_")!=1 || addform.user.value.length<2 || addform.user.value.length>16) {
alert("\用户注册出错,下面是产生错误的可能原因:\n\n·用户名必须是2-16位的数字、英文或下划线")
return false;
}
return true;
}
function isNumberString (InString,RefString)
{
if(InString.length==0) return (false);
for (Count=0; Count < InString.length; Count++) {
TempChar= InString.substring (Count, Count+1);
if (RefString.indexOf (TempChar, 0)==-1)
return (false);
}
return (true);
}
// -->
</script>
<form name="addform" method="post" action="?action=passone" onSubmit="return checkdata()">
<tr>
<td height="25" colspan=2>当前位置:<a href=index.asp>首页</a> >> <a href=LookupPass.asp>找回密码</a></td>
</tr>
<tr bgcolor="#efefef">
<td colspan=2 height="25" style="border-bottom:1px #999999 solid"> <strong>找回密码第一步 >> 填写用户名</strong></td>
</tr>
<tr>
<td width="26%" align="right"></td>
<td width="74%" height="350">用 户 名:<input name="user" type="text" size="20" maxlength="16" class=input2> 2-16个<font color=red>英文、数字或下划线</font><br><br>用户类型:<select name="qylx">
<option value=0>企业用户</option>
<option value=1>个人用户</option>
</select><br><br> <input type="submit" name="Submit" value="下一步" class=input1></td>
</tr>
</form>
<%end if%>
</table>
<!--====== bottom ========-->
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor=#ffffff>
<tr><td height=10></td></tr>
<tr><td height=2 bgcolor=#4795EC></td></tr>
<tr>
<td align="center" height=80><%=citybottom%></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?