<!--#include virtual="/inc/conn.asp"-->
<!--#include virtual="/inc/sitecon.asp"-->
<!--#include virtual="/inc/chkuser.asp"-->
<!--#include virtual="/inc/getip/index.asp"-->
<!--#include virtual="/show/mokuai/sms.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
body,td,th {
	font-size: 13px;
}
-->
</style>

<%
call logname("9,99,99,99,99,99,99")
call chkwurl()
response.Cookies("adminpasscode")=""
response.Cookies("codelast")=""
useripd=Look_Ip(userinip)

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

'function gettel(url,cset) 
'dim Http 
'set Http=server.createobject("MSXML2.XMLHTTP") 
'Http.open "GET",url,false 
'Http.send() 
'if Http.readystate<>4 then exit function 
'gettel=BytesToBstr(Http.responseBody,cset) 
'set http=nothing 
'if err.number<>0 then err.Clear  
'end function 


act=SafeRequestform("act")



if act="yanzheng" then

sql="select aynameid,ayjibie,aymasterid,aytel from ayname where aynameid="&request.Cookies("aynameid")&"" 
rs.open sql,conn,1,1
if rs.bof and rs.eof then call PopErr2("无此ID","/")
if cint(rs("ayjibie"))<>9 then call PopErr2("权限不足1-1","/")
if cint(rs("aymasterid"))<>9 then
aytel=trim(rs("aytel"))
else
	if zztel="" then
	call logadd(request.Cookies("aynameid"),"管理-权限手机未找到手机号"&request.Cookies("aynameid"),0,1)
	call PopErr2("参数错误2-1","/")
	end if
	aytel=zztel
end if
rs.close


ayadmintelpass=trim(SafeRequestform("ayadmintelpass"))
ayyanzhengids=trim(SafeRequestform("ayyanzhengids"))
if trim(ayadmintelpass)="" or trim(ayyanzhengids)="" then call PopErr("请填写完整")

if ayadmintelpass<>trim(aytel) then
call logadd(request.Cookies("aynameid"),"管理-权限手机输入错误"&ayadmintelpass,0,1)
call PopErr2("参数错误3-1","/")
end if

telpasscode=RndNumber(100000,999999)
conn.Execute("Insert Into ayyanzheng(ayyanzhengids,ayyanzhengidc) values('"&ayyanzhengids&"','"&md5(telpasscode)&"')")
body="本次的验证码："&telpasscode&"(10分钟有效)"

call mokuai_sms("IK01","2",trim(aytel),body,telpasscode,"","","")

response.Cookies("codelast")="yes"

end if


if act="yanzhengm" then

sql="select aynameid,ayjibie,aymasterid,aymail from ayname where aynameid="&request.Cookies("aynameid")&"" 
rs.open sql,conn,1,1
if rs.bof and rs.eof then call PopErr2("无此ID","/")
if cint(rs("ayjibie"))<>9 then call PopErr2("权限不足1-1","/")
if cint(rs("aymasterid"))<>9 then
aymail=trim(rs("aymail"))
else
	if zzmail="" then
	call logadd(request.Cookies("aynameid"),"管理-权限邮箱未找到邮箱"&request.Cookies("aynameid"),0,1)
	call PopErr2("参数错误2-2","/")
	end if
	aymail=zzmail
end if
rs.close

ayadmintelpassm=trim(SafeRequestform("ayadmintelpassm"))
ayyanzhengids=trim(SafeRequestform("ayyanzhengidsm"))
if trim(ayadmintelpassm)="" or trim(ayyanzhengids)="" then call PopErr("请填写完整")

if ayadmintelpassm<>trim(aymail) then
call logadd(request.Cookies("aynameid"),"管理-权限邮箱输入错误"&ayadmintelpassm,0,1)
call PopErr2("参数错误3-2","/")
end if

telpasscode=RndNumber(100000,999999)
conn.Execute("Insert Into ayyanzheng(ayyanzhengids,ayyanzhengidc) values('"&ayyanzhengids&"','"&md5(telpasscode)&"')")
body="来自"&webname&"，本次后台验证码是"&telpasscode

conn.Execute("Insert Into mailto(mlei,mto,mti,mcon) values('2','"&trim(aymail)&"','"&body&"','"&body&"')")

response.Cookies("codelast")="yes"

end if






if act="yanzheng2" then
ayadmintelpass2=trim(SafeRequestform("ayadmintelpass2"))
ayyanzhengids2=trim(SafeRequestform("ayyanzhengids2"))
if trim(ayadmintelpass2)="" or trim(ayyanzhengids2)="" then call PopErr("请填写完整")
sql="select aynameid from ayname where aynameid="&request.Cookies("aynameid")&" and ayjibie=9" 
rs.open sql,conn,1,1
if rs.bof and rs.eof then
call logadd(request.Cookies("aynameid"),"管理-权限错误未找到管理员"&request.Cookies("aynameid"),0,1)
call PopErr("权限错误5")
end if
rs.close

sql="select * from ayyanzheng where ayyanzhengids='"&ayyanzhengids2&"' and ayyanzhengidc='"&md5(ayadmintelpass2)&"'" 
rs.open sql,conn,1,3
if rs.bof and rs.eof then
call logadd(request.Cookies("aynameid"),"管理-权限验证错误"&ayadmintelpass2,0,1)
call PopErr2("权限错误6","/")
else
response.Cookies("adminpasscode")="yes"
response.Cookies("codelast")=""
rs.delete
rs.update
call logadd(request.Cookies("aynameid"),"管理-权限验证登录成功"&request.Cookies("aynameid"),0,0)
response.Redirect("index.asp")
end if
rs.close

end if




%>


<title>授权验证</title><br><br><br><br><br><br><br><br><br><br><br>
<%if request.Cookies("codelast")="yes" then%>
<form name="form1" method="post" action="">
  <table width="550" border="0" align="center">
    <tr>
      <td width="151" align="center"><span class="STYLE1">验证吗：</span></td>
      <td width="192"><input name="ayadmintelpass2" type="text" id="ayadmintelpass2" maxlength="20">
      <input name="act" type="hidden" id="act" value="yanzheng2">
	  <input name="ayyanzhengids2" type="hidden" id="ayyanzhengids2" value="<%=ayyanzhengids%>">
	  </td>
      <td width="193"><input type="submit" name="Submit" value=" 验 证 "></td>
    </tr>
  </table>
</form>
<%else%>
<div align="center" class="STYLE1">
将进入平台核心功能，请选择一种验证方式！<br>
注意：管理员请输入平台手机或邮箱，客服人员使用自己的手机或邮箱！<br><br></div>
<form name="form1" method="post" action="">
  <table width="585" border="0" align="center">
    <tr>
      <td width="151" align="right"><span class="STYLE1">手机：</span></td>
      <td width="173"><input name="ayadmintelpass" type="text" id="ayadmintelpass" maxlength="20">
      <input name="act" type="hidden" id="act" value="yanzheng">
	  <input name="ayyanzhengids" type="hidden" id="ayyanzhengids" value="<%=RndNumber(100000,999999)%>">
	  </td>
      <td width="247"><input type="submit" name="Submit" value=" 获取验证码 ">
      【请勿重复点击】</td>
    </tr>
  </table>
</form>
<form name="form2" method="post" action="">
  <table width="583" border="0" align="center">
    <tr>
      <td width="151" align="right"><span class="STYLE1">邮箱：</span></td>
      <td width="172"><input name="ayadmintelpassm" type="text" id="ayadmintelpassm" maxlength="30">
      <input name="act" type="hidden" id="act" value="yanzhengm">
	  <input name="ayyanzhengidsm" type="hidden" id="ayyanzhengidsm" value="<%=RndNumber(100000,999999)%>">
	  </td>
      <td width="246"><input type="submit" name="Submit" value=" 获取验证码 ">
      【请勿重复点击】</td>
    </tr>
  </table>
</form>
<%end if%>