<!--#include virtual="/inc/conn.asp"-->
<!--#include virtual="/inc/sitecon.asp"-->
<!--#include virtual="/inc/chkuser.asp"-->
<!--#include virtual="/show/mokuai/sms.asp"-->
<%
Function RndNumber(Min,Max) 
Randomize 
RndNumber=Int((Max - Min + 1) * Rnd() + Min) 
End Function 


'验证 验证码
if trim(SafeRequestform("act"))="queren" then

sql="select aynameid,aymail,aytel from ayname where aynameid="&clng(request.Cookies("aynameid"))&"" 
rs.open sql,conn,1,1
aymail=trim(rs("aymail"))
aytel=trim(rs("aytel"))
rs.close

yzm=trim(SafeRequestform("yzm"))
fangshi=trim(SafeRequestform("fangshi"))
if yzm="" or request.Cookies("yzsum")="" then call PopErr("数据不完整")

if fangshi="tel" then
tomd5yzm=md5(yzm&aytel&ptjiami)
end if
if fangshi="mail" then
tomd5yzm=md5(yzm&aymail&ptjiami)
end if

sql="select * from ayyanzheng where ayyanzhengids='"&yzm&"' and ayyanzhengidc='"&tomd5yzm&"'" 
rs.open sql,conn,1,1
if not(rs.bof and rs.eof) then
response.Cookies("yzsum")=""
response.Cookies("gaojiyzm")=md5("gj"&request.Cookies("aynameid")&aymail&aytel&ptjiami)
call logadd(request.Cookies("aynameid"),"异地登录安全验证成功"&fangshi&"",4,0)
conn.Execute("Insert Into "&request.Cookies("rzku")&"(ayloguserid,aylogcon,aylogip,ayipd,aylogleibie,aylogerr) values("&request.Cookies("aynameid")&",'"&request.Cookies("ayusername")&"-"&request.Cookies("ayusername")&"登录"&"','"&userinip&"','"&request.Cookies("useripd")&"','1','0')")
call PopErr2("安全验证成功","/userold/index")
else
call logadd(request.Cookies("aynameid"),"异地登录安全验证失败"&fangshi&"",4,1)
call PopErr2("安全验证失败","/userold/exit")
end if
rs.close

response.End()
end if
%>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>安全验证</title>
<style type="text/css">
	body,input{font-size:12px;margin:0;	padding:0;font-family:verdana,Arial, Helvetica, sans-serif;	color:#000}
	body{text-align:center; margin:0 auto}
	.title{font-weight:bold;color:#fff;padding:6px 10px 8px 7px;}
	.bg163{background-color:#35AEE3;}
	.bg126{background-color:#0A8745;}
	.bgyeah{background-color:#009BDF;}
	.bg188{background-color:#B7A049;}
	.bgvip163{background-color:#7072B6;}
	.bgvip126{background-color:#4BA88B;}
	.errMainArea{width:546px; margin:80px auto 0 auto;text-align:left; border:1px solid #aaa}	
	.errTxtArea{ padding:30px 34px 0 110px;}
	.errTxtArea .txt_title{	font-size:120%;	font-weight:bolder;	font-family:"Microsoft YaHei";}	
	.errBtmArea{ padding:10px 8px 25px 8px ;background-color:#fff;text-align:center; }
	.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>
</head>

<body>
<script type="text/javascript">
function huoqu()
{

  var xmlhttp;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch (e){try{xmlhttp=new XMLHttpRequest();}catch (e){}}}
      
   var fangshi=document.getElementById("fangshi").value

   xmlhttp.open("get","/index/checkuser?fangshi="+ fangshi +"&act=huoquyzhoutai&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=="telerr"){alert('手机号码格式不支持');return false;}
					if (xmlhttp.responseText=="time"){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>

<%
sql="select aynameid,aymail,aytel from ayname where aynameid="&clng(request.Cookies("aynameid"))&"" 
rs.open sql,conn,1,1
if rs.bof and rs.eof then call PopErr2("出现错误","/index/exit")
usermail="****"&mid(trim(rs("aymail")),5,len(trim(rs("aymail"))))
usertel="****"&mid(rs("aytel"),5,len(rs("aytel")))
rs.close
%>


<div class="errMainArea">
	<div id="dvTitle" class="title bgvip163">为保证账户安全，请先通过安全验证</div>
    <form action="" method="post" id="form1">
	<div class="errTxtArea"> 
		<p class="txt_title">
        验证方式：
        <select name="fangshi" id="fangshi" style="height:30px;">
          <option value="tel">手机  <%=usertel%></option>
          <option value="mail">邮箱  <%=usermail%></option>
        </select>
      </p>
		<p class="txt_title">
        验 证 码 ：
          <input name="yzm" type="text" id="yzm" style="height:30px;" maxlength="6"> <input type="button" class="btnFn1" id="endtime2" value="获取验证码" onClick="huoqu()">
      </p>
	</div>
    
	<div class="errBtmArea">
    	<input name="act" type="hidden" id="act" value="queren">
        <input name="tourl" type="hidden" id="tourl" value="<%=trim(SafeRequest("tourl"))%>">
		<input name="tijiao" class="btnFn2" type="submit" value=" 确 定 ">
        <input name="fh" class="btnFn2" type="button" value=" 返 回 " onClick="history.go(-1)">
	</div>
    </form>
</div>


</body>
</html>