<!--#include virtual="/show/indexhead.asp"-->
<!--#include virtual="/inc/connhost.asp"-->
<!--#include virtual="/inc/md52.asp"-->
<!--#include virtual="/show/mokuai/sms.asp"-->
<style type="text/css">
.btnFn1 {cursor:pointer!important;cursor:hand;  height:30px; width:101px; padding:3px 5px 0 0; }
.btnFn2 {cursor:pointer!important;cursor:hand;  height:30px; width:101px; padding:3px 5px 0 0; font-weight:bold; }
</style>
<script language="javascript">
function refreshImage(img)
{
    var imageUrl = '/inc/code/'; 
    img.src = imageUrl + '?' + Math.random();
}
function maila()
{ 
   if(document.form1.formcode.value=="")
   {alert("请填写邮箱收到的验证码");return false}
    if(document.form1.code.value=="")
   {alert("请填写右侧验证码");return false}
   document.form1.tijiao1.disabled="disabled";
} 
function tela()
{ 
   if(document.form1.formcode.value=="")
   {alert("请填写手机收到的验证码");return false}
    if(document.form1.code.value=="")
   {alert("请填写右侧验证码");return false}
   document.form1.tijiao1.disabled="disabled";
} 

function editpass()
{ 
   if(document.form3.pass1.value=="")
   {alert("请填写完整");return false}
   if(document.form3.pass2.value=="")
   {alert("请填写完整");return false}
    if(document.form3.pass1.value!=document.form3.pass2.value)
   {alert("2次密码输入不一样");return false}
   document.form3.tijiaolast.disabled="disabled";
} 
</script>
<%
call chkwurl()

Function RndNumber(Min,Max) 
Randomize 
RndNumber=Int((Max - Min + 1) * Rnd() + Min) 
End Function 

act=SafeRequestform("act")
fangshi=trim(SafeRequestform("fangshi"))
userlogip=SafeRequestform("userlogip")
if trim(userlogip)="" then userlogip="000"
if request.Cookies("iplog")="" then response.Cookies("iplog")=userlogip

'重置密码
if act="editpass" then
	strcon=SafeRequestform("strcon")
	streditpass=SafeRequestform("streditpass")
	fs=SafeRequestform("fs")
	pass1=SafeRequestform("pass1")
	pass2=SafeRequestform("pass2")
	if streditpass="" or strcon="" or fs="" then call PopErr("缺少数据") 
	if pass1<>pass2 then call PopErr("两次密码输入不一致") 
	
	if fs="2" then sql="select * from ayname where aymail='"&strcon&"' and ayjibie<>9 and iszhuxiao=0"
	if fs="3" then sql="select * from ayname where aytel="&strcon&" and ayjibie<>9 and iszhuxiao=0"
	rs.open sql,conn,1,3
		if rs.bof and rs.eof then call PopErr2("未找到该商家err14","/") 
		streditpass2="ikusereditpass"&strcon&fs&rs("aynameid")&ptjiami
		streditpass2=md5(streditpass2)
		if streditpass<>streditpass2 then call PopErr2("出现错误，请重新尝试ERRSIGN-2","/") 
		rs("aypassword")=md5(trim(pass1))
	rs.update
	
	call logadd("0",strcon&"邮箱找回密重置密码成功",0,0)
	response.Cookies("passmibao")=""
	response.Cookies("yzsum")=""
	call PopErr2("密码重置成功","/index/log") 
end if


if act="mail_2" then
	strcon=trim(SafeRequestform("strcon"))
	code=SafeRequestform("code")
	formcode=SafeRequestform("formcode")
	fs=SafeRequestform("fs")
	if strcon="" or code="" or formcode="" or fs="" then call PopErr("缺少strcon数据") 
	
	if int(request.Cookies("GetCode"))<>int(trim(code)) then call PopErr("右侧验证码输入错误") 
	if request.Cookies("yzsum")="" then call PopErr("邮箱验证码生成错误！请重新获取验证码！") 
	
	yanzhengmamd5=md5(formcode&strcon&ptjiami)
	sql="select * from ayyanzheng where ayyanzhengids='"&formcode&"' and ayyanzhengidc='"&yanzhengmamd5&"'" 
	rs.open sql,conn,1,1
	if rs.bof and rs.eof then
	call PopErr("收到的验证码输入错误！")
	end if
	rs.close
		
	sql="select * from ayname where aymail='"&strcon&"' and ayjibie<>9 and iszhuxiao=0"
	rs.open sql,conn,1,1
	if rs.bof and rs.eof then call PopErr2("未找到该商家err1","/") 
			if trim(rs("aymail"))<>"" then
				if trim(rs("aymail"))<>strcon then 
				call logadd("0",uname&"找回密码邮箱错误",0,1) 
				call PopErr2("电子邮箱有误","/") 
				response.End()
				end if
				
				'newpass=RndNumber(100000,999999)
				'rs("aypassword")=md5(trim(newpass))
				'rs.update
				'msn="密码重置为："&newpass&"，请登录官网及时修改密码"
				'title="密码重置为："&newpass&"，请登录官网及时修改密码"
				'body="密码重置为："&newpass&"，请登录官网及时修改密码"
				'conn.Execute("Insert Into mailto(mlei,mto,mti,mcon) values('2','"&trim(strcon)&"','"&trim(title)&"','"&trim(body)&"')")
				'call logadd("0",uname&"找回密码邮箱新密码发送成功",0,0) 
				
				signstr="ikuserpass"&strcon&rs("aynameid")&ptjiami
				signstr=md5(signstr)
				response.Cookies("passmibao")=trim(signstr)
			else
				call logadd("0",uname&"找回密码邮箱错误",0,1) 
				call PopErr2("未找到邮箱信息","/") 
				response.End()
			end if
	rs.close
end if


if act="tel_2" then
	strcon=trim(SafeRequestform("strcon"))
	code=SafeRequestform("code")
	formcode=SafeRequestform("formcode")
	fs=SafeRequestform("fs")
	if strcon="" or code="" or formcode="" or fs="" then call PopErr("缺少strcon数据") 
	
	if int(request.Cookies("GetCode"))<>int(trim(code)) then call PopErr("右侧验证码输入错误") 
	if request.Cookies("yzsum")="" then call PopErr("手机验证码生成错误！请重新获取验证码！") 
	
	yanzhengmamd5=md5(formcode&strcon&ptjiami)
	sql="select * from ayyanzheng where ayyanzhengids='"&formcode&"' and ayyanzhengidc='"&yanzhengmamd5&"'" 
	rs.open sql,conn,1,1
	if rs.bof and rs.eof then
	call PopErr("收到的验证码输入错误！")
	end if
	rs.close
		
	sql="select * from ayname where aytel="&strcon&" and ayjibie<>9 and iszhuxiao=0"
	rs.open sql,conn,1,1
	if rs.bof and rs.eof then call PopErr2("未找到该商家err1","/") 
			if trim(rs("aytel"))<>"" then
				if trim(rs("aytel"))<>strcon then 
				call logadd("0",uname&"找回密码手机号码错误",0,1) 
				call PopErr2("手机号码有误","/") 
				response.End()
				end if
				
				signstr="ikuserpass"&strcon&rs("aynameid")&ptjiami
				signstr=md5(signstr)
				response.Cookies("passmibao")=trim(signstr)
			else
				call logadd("0",uname&"找回密码手机号错误",0,1) 
				call PopErr2("未找到手机号信息","/") 
				response.End()
			end if
	rs.close
end if


%>





<script language=javascript>
var xmlhttp;
try
{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch (e){try{xmlhttp=new XMLHttpRequest();}catch (e){}}}

function huoqu(str)
{
	

    var strcon=document.getElementById("strcon").value

    if(str=="mail")
	{
	xmlhttp.open("get","/index/checkuser?mail="+ strcon +"&act=huoqumailyz&t=" +  new Date().getTime());
	}
	if(str=="tel")
	{
	xmlhttp.open("get","/index/checkuser?Mobile="+ strcon +"&act=huoquyz&jcact=you&t=" +  new Date().getTime());
	}

   xmlhttp.onreadystatechange=function()
   {
		 if(4==xmlhttp.readyState) 
		 {
			   if(200==xmlhttp.status)
			   { 
			   		//alert(xmlhttp.responseText);
					if (xmlhttp.responseText=="ok"){alert('验证码已发送，请注意查收');RemainTime();return false;}
					if (xmlhttp.responseText=="no"){alert('未找到该手机号码');return false;}
					if (xmlhttp.responseText=="time"){alert('请再一分钟后尝试重新发送验证码');return false;}
					if (xmlhttp.responseText=="telerr"){alert('请使用正常手机号码');return false;}
			   }
			   else
			   {
				alert('网络链接失败');
				return false;
			   }
		 }
   }
   xmlhttp.send(null);  
   return false;
}


var CID = "endtime2";
var iTime = "60"; //秒

function RemainTime()
{
	document.getElementById(CID).disabled="disabled";
    var iDay,iHour,iMinute,iSecond;
    var sDay="",sHour="",sMinute="",sSecond="",sTime="";
    if (iTime >= 0)
    {
        iDay = parseInt(iTime/24/3600);if (iDay > 0){sDay = iDay + "天";}
        iHour = parseInt((iTime/3600)%24);if (iHour > 0){sHour = iHour + "小时";}
        iMinute = parseInt((iTime/60)%60);if (iMinute > 0){sMinute = iMinute + "分钟";}
        iSecond = parseInt(iTime%60);
		
        if (iSecond >= 0){sSecond = iSecond + "秒";}
        if ((sDay=="")&&(sHour=="")){sTime= sMinute+sSecond;}else{sTime=sDay+sHour+sMinute+sSecond;}
		
		if(iTime==0){sTime="获取验证码";document.getElementById(CID).disabled="";}else{Account = setTimeout("RemainTime()",1000);}
       	iTime=iTime-1;
    }
    else
    {
       iTime = "61";    //设置+1
	   RemainTime();
    }

    document.getElementById(CID).value = sTime;
}
</script>
<div class="mian">
<div class="regbox conter">
<div class="nyclassbt01 conter">找回密码</div>


<%if fangshi="2" then
response.Cookies("passmibao")=""
username=trim(SafeRequestform("username"))
code=trim(SafeRequestform("code"))
if username="" or code="" then call PopErr("缺少数据") 
if int(request.Cookies("GetCode"))<>int(trim(code)) then call PopErr("右侧验证码输入错误") 

rs.open "select * from ayname where aymail='"&username&"' and ayjibie<>9 and iszhuxiao=0",conn,1,1
if rs.bof and rs.eof then call PopErr2("未找到该邮箱","/index/pass")
rs.close
%>

<form name="form1" method="post" action="" onSubmit="return maila()">
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="280" height="50" class="regtext">邮箱：</td>
    <td width="303"><%=username%><input name="strcon" type="hidden" id="strcon" value="<%=username%>" /><input name="fs" type="hidden" id="fs" value="<%=fangshi%>" /></td>
    <td width="452"><input type="button" class="btnFn1" id="endtime2" value="获取验证码" onClick="huoqu('mail')"></td>
  </tr>
  <tr>
    <td height="50" class="regtext">邮箱验证码：</td>
    <td><input name="formcode" type="text" class="reginput" id="formcode" maxlength="6"></td>
    <td><div class="regts" >请正确输入邮箱收到的验证码</div></td>
  </tr>
  <tr>
    <td height="50" class="regtext">右侧验证码：</td>
    <td><input name="code" type="text" class="reginput" id="code" maxlength="4"></td>
    <td><img src="/inc/code/" alt="点击刷新验证码" style="cursor:pointer" border=0 onClick="refreshImage(this);"/></td>
  </tr>
  <tr>
    <td height="69" class="regtext">&nbsp;</td>
    <td align="left"><input style="cursor:pointer" name="tijiao1" type="submit" class="logindlreg" id="tijiao1" value=" 提 交 验 证 "></td>
    <td><input name="act" type="hidden" id="act" value="mail_2"></td>
  </tr>
  </table>
</form>
<br>

<%elseif fangshi="3" then
response.Cookies("passmibao")=""
username=trim(SafeRequestform("username"))
code=trim(SafeRequestform("code"))
if isNumeric(username)=false then call PopErr("请正确填写手机号") 
if username="" or code="" then call PopErr("缺少数据") 
if int(request.Cookies("GetCode"))<>int(trim(code)) then call PopErr("右侧验证码输入错误") 

rs.open "select * from ayname where aytel="&username&" and ayjibie<>9 and iszhuxiao=0",conn,1,1
if rs.bof and rs.eof then call PopErr2("未找到该手机号","/index/pass")
rs.close
%>

<form name="form1" method="post" action="" onSubmit="return tela()">
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="280" height="50" class="regtext">手机号：</td>
    <td width="303"><%=username%><input name="strcon" type="hidden" id="strcon" value="<%=username%>" /><input name="fs" type="hidden" id="fs" value="<%=fangshi%>" /></td>
    <td width="452"><input type="button" class="btnFn1" id="endtime2" value="获取验证码" onClick="huoqu('tel')"></td>
  </tr>
  <tr>
    <td height="50" class="regtext">手机验证码：</td>
    <td><input name="formcode" type="text" class="reginput" id="formcode" maxlength="11"></td>
    <td><div class="regts" >请正确输入手机收到的验证码</div></td>
  </tr>
  <tr>
    <td height="50" class="regtext">验证码：</td>
    <td><input name="code" type="text" class="reginput" id="code" maxlength="4"></td>
    <td><img src="/inc/code/" alt="点击刷新验证码" style="cursor:pointer" border=0 onClick="refreshImage(this);"/></td>
  </tr>
  <tr>
    <td height="69" class="regtext">&nbsp;</td>
    <td align="left"><input style="cursor:pointer" name="tijiaotel" type="submit" class="logindlreg" id="tijiaotel" value=" 提 交 验 证 "></td>
    <td><input name="act" type="hidden" id="act" value="tel_2"></td>
  </tr>
  </table>
</form>
<br>

<%end if%>





<%if request.Cookies("passmibao")<>"" then

if fs="2" then sql="select * from ayname where aymail='"&strcon&"' and ayjibie<>9 and iszhuxiao=0"
if fs="3" then sql="select * from ayname where aytel="&strcon&" and ayjibie<>9 and iszhuxiao=0"
rs.open sql,conn,1,1
if rs.bof and rs.eof then call PopErr2("未找到该会员err4","/") 
						
signstr2="ikuserpass"&strcon&rs("aynameid")&ptjiami
signstr2=md5(signstr2)
	
if request.Cookies("passmibao")<>trim(signstr2) then call PopErr2("出现错误，请重新尝试ERRSIGN","/") 

streditpass="ikusereditpass"&strcon&fs&rs("aynameid")&ptjiami
streditpass=md5(streditpass)

rs.close
%>

<form name="form3" method="post" action="" onSubmit="return editpass()">
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="280" height="50" class="regtext">设置新密码：</td>
    <td width="303"><input name="pass1" id="pass1" type="password" class="reginput" maxlength="20"></td>
    <td width="452"><div class="regts" >请设置一个新的密码</div></td>
  </tr>
  <tr>
    <td width="280" height="50" class="regtext">确认新密码：</td>
    <td width="303"><input name="pass2" id="pass2" type="password" class="reginput" maxlength="20"></td>
    <td width="452"><div class="regts" >请再次确认新的密码</div></td>
  </tr>
  <tr>
    <td height="69" class="regtext">&nbsp;</td>
    <td align="left"><input style="cursor:pointer" name="tijiaolast" type="submit" class="logindlreg" id="tijiaolast" value=" 设 置 密 码 "></td>
    <td><input name="act" type="hidden" id="act" value="editpass"><input name="strcon" type="hidden" id="strcon" value="<%=strcon%>" /><input name="fs" type="hidden" id="fs" value="<%=fs%>" /><input name="streditpass" type="hidden" id="streditpass" value="<%=streditpass%>" /></td>
  </tr>
  </table>
</form>
<br>


<%end if%>




</div>
</div>



<!--#include virtual="/show/indexfoot.asp"-->