<!-- #Include File="../Include/Config.asp" -->
<!-- #Include File="../Include/Inc_Md5.asp" -->
<!-- #Include File="../Include/Inc_Ipstop.asp" -->
<!-- #Include File="Include/AMH_Fir.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

Dim user_ip
	user_ip = Cls.Ip_Sys(0)
call user_ip_stop1() 

Dim Session_For
Session_For = Cls.Web_Cookies&"_"

If Action="logout" Then
	Session.Abandon
	Call Format_Redirect(Cls.Web_Dir)
End If

If Int(Web_Dim(0)) = 0 Then
	If int(format_mid_num(4))=1 Then
		If login_mode="" then
			Response.Write"<Script>alert('非法登录,系统识别你没有登陆帐号，请前台登陆您的帐号！');location.href='"&Cls.Web_Dir&"User/Login.asp'</script><Script>window.close();</script>" 
		else
			if Cls.Cookies_Get("login_mode")<>"admin" then
				Response.Write"<Script>alert('非法登录,系统识别你没有管理权限或不是管理员！\n\n你的IP已经记录！');location.href='"&Cls.Web_Dir&"'</script><Script>window.close();</script>" 
			end if
		end if 
	end if
	If Cls.Session_Get(Session_For&"Admin")="Admin"  Then
		Call Format_Redirect("AMH_Index.asp")
	End If
End If

Dim aChk,UserName2,CheckSiteManageCode
tit="管理后台"
'检查后台管理认证码
CheckSiteManageCode = False
If Cls.Is_Null(Cls.Web_AdminCodes)<>"" Then
         CheckSiteManageCode = True
End If
%>

<html>
<head>
<title><%Response.Write Cls.Web_Name%> - <%Response.Write tit%></title>
<meta http-equiv=Content-Type content=text/html; charset=gb2312>

<style>
body,td,th,div{font-size:12px;font-family:Arial, Helvetica, sans-serif;}
a{text-decoration:none;color:#000000;}
.blu{color:#0266b7;font-size:14px;}
.gre{color:#329408;font-size:14px;}
.red{color:#F00;font-size:14px;}
</style>

<script language=javascript src='images/admin.js'></script>
<script language=javascript src='<%=Cls.Web_Dir%>style/select.js'></script>
<script language="JavaScript" src="<%=Cls.Web_Dir%>Style/Softkeyboard.js" type="text/javascript"></script>
<script language=javascript>
<!--
function AMH_login_chk()
{
  var username=document.AMH_frm.username.value;
  var password=document.AMH_frm.password.value;
  if (username=="" || username==null)
  {
    alert("对不起！\n\n请先输入登陆用户名称！");
    document.AMH_frm.username.focus();
    return false;
  }
  var password=document.AMH_frm.password.value;
  if (password=="" || password==null)
  {
    alert("对不起！\n\n请先输入登陆用户密码！");
    document.AMH_frm.password.focus();
    return false;
  }
  <%if CheckSiteManageCode = True then%>
  var valcode=document.AMH_frm.valcode.value;
  if (valcode=="" || valcode==null)
  {
    alert("对不起！\n\n请先输入后台验证码！");
    document.AMH_frm.valcode.focus();
    return false;
  }
  <%end if%>
  return true;
}
-->
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<noscript><iframe src=*.htm></iframe></noscript>
<center>
<%
If Cls.Code_Admin("AMH_log",1,0)="ok" Then
if request.cookies("ACE_Code")<>trim(request("ACE_Code")) then
Response.Write Cls.Js_put("alert(""错误："&request.cookies("sai1")&"+"&request.cookies("sai2")&"≠"&request("ACE_Code")&"\n正确："&request.cookies("sai1")&"+"&request.cookies("sai2")&"＝"&request.cookies("ACE_Code")&"\n您的计算有误，请重新登录！"");history.back(1);",1)
else
	aChk=AMH_Chk()
	If aChk Then
		Login_UserName=UserName2
		Call AMH_Event("成功登陆管理后台。")
		Call Format_Redirect("AMH_Index.asp")
	Else
		Login_UserName=UserName2
		Call AMH_Event("登陆管理后台失败。")
		call ip_stop1()
		dim lockmsg
		lockmsg="\n\n为防止恶意攻击,你的IP已被记录。"
		if useripstop=0 then lockmsg=""
		Response.Write Cls.Js_put("alert(""登陆失败！"&lockmsg&"\n\n请确认你的登陆信息，并重新登陆……"");history.back(1);",1)
	End If
end if
Else
dim sai1,sai2,saihe
Randomize 
sai1=int(10*Rnd)
Randomize 
sai2=int(10*Rnd)
saihe=sai1+sai2
response.cookies("sai1")=sai1
response.cookies("sai2")=sai2
response.cookies("ACE_Code")=saihe
Call AMH_Login()
End If
Call AMH_Ender(tit)
Sub AMH_Login()
%>
<table width="100%" height="613" border="0" cellpadding="0" cellspacing="0" background="images/login/login_01.gif" align="center">
<tr><td height="49"></td></tr>
<tr><td>
<table width="545" height="564" border="0" cellspacing="0" cellpadding="0" background="images/login/login_04.gif" align="center">
<tr><td>

<table width="380" border="0" align="center" cellpadding="5" cellspacing="0">
<form name=AMH_frm action='?' method=post>
<input type=hidden name=AMH_log value='ok'>
<tr><td height="100" colspan="3"></td></tr>
<tr>
<td width="58" align="right"><img src="images/login/user.gif" /></td>
<td width="85" class="blu"><strong>管理帐户：</strong></td>
<td width="207"><input type="text" name="username" id="username" style="width:164px;height:32px;line-height:34px;background:url(images/login/inputbg.gif) repeat-x;border:solid 1px #d1d1d1;font-size:9pt;font-family:Verdana, Geneva, sans-serif;" /></td>
</tr>
<tr>
<td align="right"><img src="images/login/password.gif" /></td>
<td class="gre"><strong>登录密码：</strong></td>
<td><input type="password" name="password"id="UserPassword" onKeyDown="Calc.password.value=this.value" onBlur="tipLogPwd.className='tip_off'" onClick="password1=this;showkeyboard();this.readOnly=0;Calc.password.value=''" style="width:164px;height:32px;line-height:34px;background:url(images/login/inputbg.gif) repeat-x;border:solid 1px #d1d1d1;font-size:9pt;" /></td>
</tr>
<tr>
<td align="right"><img src="images/login/code.gif" /></td>
<td class="red"><strong>计算验证：</strong></td>
<td><input type="text" name="ACE_Code" id="ACE_Code" style="text-align:center;width:66px;height:32px;line-height:34px;background:url(images/login/inputbg.gif) repeat-x;border:solid 1px #d1d1d1;font-size:9pt;" /><strong style="font-size:18px"> = <%=sai1%> + <%=sai2%></strong></td>
</tr>
<%if CheckSiteManageCode = True then%><input type="hidden" name="valcode" id="valcode" value="<%=Cls.Web_AdminCodes%>" /><%end if%>
<tr>
<td height="60" align="right"><input type="checkbox" name="logins" value="yes"></td>
<td class="gre"><strong>登录前台</strong></td>
<td><input name="image" type="image" value="确认" src="images/login/login.gif" align="middle"></td>
</tr>
</form>
</table>

</td></tr>
</table>
</td></tr>
</table>
<div align="center">版权所有 &copy; <a href="../"><%Response.Write Cls.Web_Name%></a>&nbsp;&nbsp;<%Response.Write Cls.Web_Url%></div>
<%
End Sub

Function AMH_Chk()
	Dim username,password,founderr,rs,sql,id,power,hidden,valcode,safety,logins
	username=Cls.Code_Admin("username",1,20)
	password=Cls.Code_Admin("password",1,20)
	valcode=Cls.Code_Form("valcode")
	logins=Cls.Code_Form("logins")
	username2=username
	founderr=""
	AMH_Chk=False
		if CheckSiteManageCode = True then
	If Cls.Is_Null(Cls.Web_AdminCodes)<>"" Then
'		If Cls.Is_Null(valcode)="" Then Exit Function
'		If AsaiMHMd5(valcode,"short")<>Cls.Web_AdminCodes Then Exit Function
		If Cls.Is_Null(valcode)="" or valcode<>Cls.Web_AdminCodes Then
		Exit Function
		end if
	End If
	End If

	If ChkName(username)=False Or ChkPassWord(password)=False Then Exit Function
	If founderr="" Then
		password=AsaiMHMd5(password,"short")
		SQL = "Select Top 1 m_level From [AsaiMHUserData] Where Username='"&username&"' And Password='"&password&"' And Power='"&format_power2(1,1)&"' And Hidden=1"
		Set Rs=Cls.Exec(SQL,1)
		If Rs.Eof Then
			Rs.Close
			Exit Function
		End If
		If logins="yes" Then
		    response.cookies(Cls.web_cookies).path=Cls.Web_Dir                 '写入cookies的路径
			Response.Cookies(Cls.web_cookies)("login_username")=Username
			Response.Cookies(Cls.web_cookies)("login_password")=AsaiMHEncrypt(password)
			Response.Cookies(Cls.web_cookies)("iscookies")="yes"
			Response.Cookies(Cls.web_cookies).expires=Date+365
		End If
		Cls.Session_Set Session_For&"Admin","Admin"
		Cls.Session_Set Session_For&"Admins",Username
		Cls.Session_Set Session_For&"m_level",Rs("m_level")
		Rs.Close
	End If
	AMH_Chk=True
End Function
%>
</center></body></html>