<!--#include file="inc/conn.asp"-->
<!--#include file="inc/jle_sub.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="inc/md5.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><%=title%>-找回密码</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="zh-cn" />
<meta name="Keywords"  content="<%=metakey%>" />
<meta name="Description" content="<%=metades%>" />
<link rel="icon" href="<%=web%>/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="<%=web%>/favicon.ico" type="image/x-icon" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<SCRIPT language=javascript>
<!--
function CheckloginForm()
{
if(document.thisForm.username.value.length<1)
	{
	    alert("登陆帐号没有填写!");
	          
	    return false;
	}
if(document.thisForm.email.value.length<1)
	{
	    alert("注册时电子邮箱请务必填写!");
	         
	    return false;

	}
}

//-->
</SCRIPT>
</head>
<body>
<%call top()%><div id="Fmain">


 <div id=FFTit class=F12bold><a href="/">首页</a>-<a href="#">找回密码</a></div><div id=FFContent><div Class='FFdiv'>
<%
dim pass,uname
uname=HtmlEncode(trim(Request.form("username")))
email=HtmlEncode(trim(Request.form("email")))
m=Request.form("m")
if m<>"" or username<>"" or email<>"" then

'随机生产密码
i=6
function gen_key(digits)
dim rndnum,num
Randomize
Do while Len(rndnum)<digits
num = Cstr(Chr((57-48)*rnd+48))
rndnum = rndnum & num
Loop
gen_key = rndnum
End function
'Response.write gen_key(i)
pass=gen_key(i)

if request.cookies("jle")("errs")="" then
k=0
else
k=request.cookies("jle")("errs")
end if
if request.cookies("jle")("errs")>3 then
Response.Write "<script language='javascript'>alert('您取回新密码的次数已经超过3次,系统保护中,请稍后再试！');history.back();</script>" 
response.end
end if

set rs=server.createobject("adodb.recordset")
if Request.form("user")="g" then
sql="select * from [user] where username='"&uname&"' and email='"&email&"'"
else
sql="select * from [com] where username='"&uname&"' and email='"&email&"'"
end if
rs.open sql,conn,1,3
if rs.eof and rs.bof then
Response.cookies("jle")("errs")=k+1
Response.Write "<script language='javascript'>alert('您的用户名或注册时电子邮箱不相符！');history.back();</script>" 
response.end
else
rs("password")=md5(pass)
rs.update

call mail()
response.write "<br><br><p align=center><font size=4><li>您的密码已经发送到<b>"&email&"</b>，请注意查收！</font></p>"

sub mail()
dim mailbody,Jmail
mailbody="您好,"&username&"!<br>您已成功取回了新的密码！现在资料为：登陆帐号：[<b>"&uname&"</b>] 您的新密码是：[<b>"&pass&"</b>]<br> 请及时登陆<a target=_blank  href="&web&">"&title&""&web&"</a>修改为您的密码！<br>感谢您使用我们<a target=_blank  href="&web&">"&title&"</a>为您提供的真诚服务！<br>["&title&"]打造最专业的信息发布平台"   '邮件内容
Set Jmail=server.createobject("Jmail.Message")
Jmail.Charset ="gb2312"
JMail.ContentType = "text/html"
Jmail.Silent =true
Jmail.Priority = 3
Jmail.MailServerUserName = mailname
Jmail.MailServerPassword = mailpass
Jmail.From = mailform
Jmail.FromName =""&title&""
Jmail.Subject ="您的新密码！-"&title&""
Jmail.AddRecipient ""&email&""
Jmail.Body = mailbody
Jmail.Send(mailsmtp)
Set Jmail=nothing
end sub

end if
rs.close
set rs=nothing
closedb

else
%>
<form id="f1" name="thisForm" action="?" method="POST">
<div align="center">
<table width="100%" cellpadding="0">
<tr>
<td height="33" align="center" width="86%">如果您的登陆密码忘记了,你可以通过如下方式重新设置您的密码</tr>
<tr>
<td height="33" align="center" width="86%">
<input type="radio" value="g" name="user" checked>个人用户 
<input type="radio" value="s" name="user">商家用户</tr>
<tr>
<td height="33" align="center" width="86%">&nbsp; 登陆帐号：<input maxLength="20" size="19" name="username"> 
*</tr>
<tr>
<td height="33" align="center" width="86%">注册时邮箱：<input maxLength="32" size="19" name="email"> 
* </tr>
<tr>
<td height="50" width="86%"><p align="center">&nbsp;&nbsp;<input type="hidden" name="login" value="jle"><input  onclick="javascript:return CheckloginForm();" type="submit" value="取回密码" name="m" style="font-weight:bold;font-size: 12pt;height:50"></td></tr><tr>
<td height="25" align="center" width="86%">
如果您无法通过上述方法修复密码，请到<a href="feedback.asp">问题反馈</a>留下您的问题。<br>
</td></tr><tr>
<td width="86%">
　</td></tr></table>
</div>
</form>
<%end if%>
</div>
</div>
 <br style="clear:both;" />


<div id="footer">
<%
call bottom()
%>
</div>
</div>
</body>
</html>