<!--#include virtual="/inc/conn.asp"--> 
<!--#include virtual="/inc/sitecon.asp"--> 
<!--#include virtual="/inc/md52.asp"-->
<!--#include virtual="/inc/getip/index.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
'call logname("9,99,99,99,99,99,99")
'call chkwurl()

if request.Cookies("adminpass")<>"" then response.Redirect("index.asp")

act=SafeRequestform("act")
if act="denglu" then

ayadminpass=trim(SafeRequestform("ayadminpass"))
uid=trim(SafeRequestform("uid"))
upass=trim(SafeRequestform("upass"))
chkcode=trim(SafeRequestform("chkcode"))

if trim(ayadminpass)="" or trim(uid)="" or trim(upass)="" or trim(chkcode)="" then PopErr("请填写完整")
if int(request.Cookies("GetCode"))<>int(chkcode) then PopErr("验证码错误")

sql="select * from ayname where ayusername='"&uid&"' and aypassword='"&md5(upass)&"'"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
response.Cookies("adminpass")=""
call logadd(0,"后台登录帐号或密码错误"&uid,0,1)
call PopErr2("帐号或密码错误","logadminpass.asp") 
else
	if cint(rs("ayjibie"))<>9 then 
	response.Cookies("adminpass")=""
	call logadd(rs("aynameid"),"后台登录权限错误"&ayadminpass,0,1)
	call PopErr2("权限错误","/index/exit") 
	response.End()
	end if
	
	if cint(rs("aymasterid"))<>9 then 
		if trim(rs("mdulipa"))<>"" and isnull(trim(rs("mdulipa")))=false then
			if trim(rs("mdulipa"))<>md5(ayadminpass) then
			response.Cookies("adminpass")=""
			call logadd(rs("aynameid"),"独立密码错误"&ayadminpass,0,1)
			call PopErr("独立密码错误")
			response.End()
			end if
			response.Cookies("ayusername")=trim(rs("ayusername"))
			response.Cookies("aynameid")=rs("aynameid")
			response.Cookies("aytrueuser")=rs("aytrueuser") 
			response.Cookies("aymasterid")=rs("aymasterid")
			response.Cookies("ayjibie")=rs("ayjibie")
			response.Cookies("ayadminnameid")=rs("aynameid")
			response.Cookies("ayadminjibie")=rs("ayjibie")
			response.Cookies("adminpass")="yes"
			response.Cookies("kamiku")=trim(rs("kamiku"))
			response.Cookies("flku")=trim(rs("flku"))
			response.Cookies("spku")=trim(rs("spku"))
			response.Cookies("ddku")=trim(rs("ddku"))
			response.Cookies("cwku")=trim(rs("cwku"))
			response.Cookies("rzku")=trim(rs("rzku"))
			
			signstr="ikuserdl"&rs("aynameid")&trim(rs("ayusername"))&rs("ayjibie")&trim(rs("ddku"))&trim(rs("cwku"))&trim(rs("rzku"))&ptjiami
			signstr=md5(signstr)
			response.Cookies("aysignmd5")=signstr
			
			response.Cookies("useripd")=Look_Ip(userinip) 'IP位置
			
			call logadd(rs("aynameid"),"管理-独立后台登录成功"&request.Cookies("aynameid"),0,0)
			'conn.Execute("Insert Into aysign(aysignuid,aysignmd5) values("&rs("aynameid")&",'"&signstr&"')")
			conn.execute "update ayname set aylastdata='"&now()&"',aylastip='"&userlogip&"' where aynameid="&request.Cookies("aynameid")&""
			response.Redirect "index.asp"

		else
		call logadd(rs("aynameid"),"独立密码未设置"&ayadminpass,0,1)
		call PopErr2("独立密码未设置","/index/exit") 
		response.End()
		end if
	else
		set rsq=server.CreateObject("adodb.recordset")
		sqlq="select ayadminpass from ayquanju" 
		rsq.open sqlq,conn,1,1
		if md5(ayadminpass)<>trim(rsq("ayadminpass")) then
		response.Cookies("adminpass")=""
		call logadd(rs("aynameid"),"管理-独立密码输入有误"&ayadminpass,0,1)
		call PopErr2("独立密码输入有误","/")
		else
		response.Cookies("ayusername")=trim(rs("ayusername"))
		response.Cookies("aynameid")=rs("aynameid")
		response.Cookies("aytrueuser")=rs("aytrueuser") 
		response.Cookies("aymasterid")=rs("aymasterid")
		response.Cookies("ayjibie")=rs("ayjibie")
		response.Cookies("ayadminnameid")=rs("aynameid")
		response.Cookies("ayadminjibie")=rs("ayjibie")
		response.Cookies("adminpass")="yes"
		response.Cookies("kamiku")=trim(rs("kamiku"))
		response.Cookies("flku")=trim(rs("flku"))
		response.Cookies("spku")=trim(rs("spku"))
		response.Cookies("ddku")=trim(rs("ddku"))
		response.Cookies("cwku")=trim(rs("cwku"))
		response.Cookies("rzku")=trim(rs("rzku"))

		signstr="ikuserdl"&rs("aynameid")&trim(rs("ayusername"))&rs("ayjibie")&trim(rs("ddku"))&trim(rs("cwku"))&trim(rs("rzku"))&ptjiami
		signstr=md5(signstr)
		response.Cookies("aysignmd5")=signstr
			
		response.Cookies("useripd")=Look_Ip(userinip) 'IP位置
		call logadd(rs("aynameid"),"管理-独立后台登录成功"&request.Cookies("aynameid"),0,0)
		'conn.Execute("Insert Into aysign(aysignuid,aysignmd5) values("&rs("aynameid")&",'"&signstr&"')")
		conn.execute "update ayname set aylastdata='"&now()&"',aylastip='"&userlogip&"' where aynameid="&request.Cookies("aynameid")&""
			response.Redirect "index.asp"
		end if
		rsq.close
	
	end if

end if



rs.close
end if
%>
<style type="text/css">
<!--
.STYLE1 {font-size: 12px}
.newlogin{
    background-color: transparent;
    background-image: url("<%=ossurl%>Template/Template4/an/denglu.gif");
    border: medium none;
    background-position: 0 -198px;
    width: 90px;
	color: #FFFFFF;
    font-weight: bold;
    height: 33px;
    line-height: 28px;
    padding: 0 10px 3px;
}
.STYLE2 {font-size: 13px}
-->
</style>



<title>登陆后台-<%=webname%></title>

<br><br><br><br><br><br><br><br><br><br><br>
<form name="form1" method="post" action="">
  <table width="546" height="309" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td background="<%=ossurl%>Template/Template4/images/masterbj.jpg"><table width="449" height="157" border="0" align="center">
        <tr>
          <td width="88" height="25" align="center">&nbsp;</td>
          <td width="95" align="center"><span class="STYLE1">用户名</span></td>
          <td colspan="2" align="left"><input name="uid" type="text" id="uid" size="25" maxlength="20" /></td>
          </tr>
        <tr>
          <td height="25" align="center"></td>
          <td align="center"><span class="STYLE1">密 码</span></td>
          <td colspan="2" align="left"><input name="upass" type="password" id="upass" size="26" maxlength="20" /></td>
          </tr>
        <tr>
          <td height="25" align="center"></td>
          <td align="center"><span class="STYLE1">独立密码</span></td>
          <td colspan="2" align="left"><input name="ayadminpass" type="password" id="ayadminpass" size="26" maxlength="20" />
              <input name="act" type="hidden" id="act" value="denglu" /></td>
          </tr>
        <tr>
          <td height="25" align="center"></td>
          <td align="center"><span class="STYLE1">验证码</span></td>
          <td width="88" align="left"><input name="chkcode" type="text" id="chkcode" style="width:80px" maxlength="4"/></td>
          <td width="160" align="left"><img src="/inc/code/" alt="点击刷新验证码" height="25" border="0" onclick="this.src='/inc/code/'"/></td>
        </tr>
        <tr>
          <td height="25" align="center">&nbsp;</td>
          <td align="center"><a href="logadminsetpass.asp"><span class="STYLE2">设置独立密码</span></a></td>
          <td colspan="2" align="left">
		  <input style="cursor:pointer"  class="newlogin" type="submit" name="Submit" id="tijiao" value="" /></td>
          </tr>
      </table></td>
    </tr>
  </table>
</form>
<script type="text/javascript">
function refreshImage(img)
{
    var imageUrl = '/inc/code/'; 
    img.src = imageUrl + '?' + Math.random();
}
</script>