<!--#include file="../Conn.asp"-->
<!--#include file="CheckCode.asp"-->
<!--#include file="../ACT_inc/MD5.asp"-->
<!--#include file="../ACT_inc/ACT.Main.asp"-->
<% 
	ConnectionDatabase
	Dim ACTCMS
	Set ACTCMS = New ACT_Main
	Select Case Request("Action")
			Case "LoginCheck"
				Call LoginCheck()
			Case "LoginOut"
				Call LoginOut()
			Case Else
				Call ACT_login_Main()
	End Select
	
	Sub LoginCheck()
		Dim A_PWD,PassWord,UserName,Act_Code,SqlStr,RS
		If CheckCode=True Then 
			Act_Code = Request.Form("Code")
			If CStr(Act_Code) <>CStr(Session("GetCode")) then
				Response.Write("<script>alert('验证码有误，重新输入！');history.back();</script>")
				Response.End
			End If
		End If 

		If CheckManageCode=True Then 
			If CStr(Request.Form("CheckManageCode")) <>CStr(CheckManageCodeContent) then
				Response.Write("<script>alert('认证码有误，重新输入！');history.back();</script>")
				Response.End
			End If
		End If 

		A_PWD = MD5(Request.Form("PassWord"))
		UserName = ACTCMS.RSQL(Request.Form("UserName"))
		PassWord = ACTCMS.RSQL(Request.Form("PassWord"))
	 	 Set RS = Server.CreateObject("ADODB.RecordSet")
	 	 SqlStr = "select * from Admin_ACT where Admin_Name='" & UserName & "'"
	 	 RS.Open SqlStr,Conn,1,3
		 	IF Rs.eof And Rs.bof Then
				Call ACTCMS.InsertLog(UserName,1,0,PassWord)
				Response.Write("<script>alert('登录失败:\n\n您输入了错误的管理帐号，请再次输入！');history.back();</script>")
				Response.End
			Else
				IF Rs("PassWord") = A_PWD Then
					IF Rs("Locked") = 1 Then
						Response.Write("<script>alert('登录失败:\n\n您的账号已被管理员锁定，请与您的系统管理员联系！');history.back();</script>")
						Response.End
					Else
							Rs("LoginTime") = Now
							Rs("LoginIP") = ACTCMS.GetIP()
							Rs("LoginNumber") = Rs("LoginNumber")+1
							Rs.Update
							Response.Cookies(AcTCMSN)("AdminName") = Rs("Admin_Name")
							Response.Cookies(AcTCMSN)("AdminPassword") = Rs("PassWord")
							Response.Cookies(AcTCMSN)("AdminID") = Rs("ID")
							If Rs("SuperTF")=1 Then Response.Cookies(AcTCMSN)("SuperTF")=1
							Response.Cookies(AcTCMSN)("Purview") = Rs("Purview")
							Response.Cookies(AcTCMSN)("ACT_Other") = Rs("ACT_Other")
							Response.Cookies(AcTCMSN)("HQQXLX") = Rs("ACTCMS_QXLX")
					End IF
				Else
						Call ACTCMS.InsertLog(UserName,0,1,"密码错误:"&PassWord)
						Response.Write("<script>alert('登录失败:\n\n您输入了错误的口令，请再次输入！');history.back();</script>")
						Response.End
				End IF
						Rs.Close:Set Rs = Nothing
						Call ACTCMS.InsertLog(UserName,1,1,"*******")
						Response.Redirect("Index.asp")
			End IF
	End Sub

	Sub LoginOut()
		Response.Cookies(AcTCMSN)("AdminName") =""
		Response.Cookies(AcTCMSN)("AdminPassword") = ""
		Response.Cookies(AcTCMSN)("AdminID") = ""
		Response.Cookies(AcTCMSN)("SuperTF")=0
		Response.Cookies(AcTCMSN)("Purview") = ""
		Response.Cookies(AcTCMSN)("ACT_Other") = ""
		Response.Cookies(AcTCMSN)("HQQXLX") = ""
		Response.Redirect("Login.asp")
	End Sub
	Sub ACT_login_Main()
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>ACTCMS管理系统-网站后台管理</title>

<style type="text/css">
<!--


TABLE {
	FONT-SIZE: 12px
}
.inp {
	BORDER-RIGHT: #84a1bd 1px solid; PADDING-RIGHT: 2px; BACKGROUND-POSITION: -70px -424px; BORDER-TOP: #84a1bd 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; BORDER-LEFT: #84a1bd 1px solid; WIDTH: 157px; PADDING-TOP: 2px; BORDER-BOTTOM: #84a1bd 1px solid;background-color:#F2FBFF;

}
.ACT_btn {
	cursor:hand;
	BACKGROUND: #ffffff;
	FONT: 12px/1.3em Arial, Helvetica, sans-serif;
	COLOR: #006699;
	border: 1px solid #84a1bd;
}
A:link {
	FONT-SIZE: 12px; COLOR: #1c4185; TEXT-DECORATION: none
}
A:visited {
	FONT-SIZE: 12px; COLOR: #1c4185; TEXT-DECORATION: none
}
A:hover {
	COLOR: #ff6600; TEXT-DECORATION: underline
}
-->
</style>
</head>
<SCRIPT LANGUAGE=javascript><!-- 
if (top.location != self.location)top.location=self.location; 
// --></SCRIPT>
<SCRIPT language="javascript">
	window.status="建议采用IE5.5以上版本浏览器、1024*768分辨率进入后台\本系统对Maxthon,Mozilla Firefox等浏览器有良好的支持-By ACTCMS";
</SCRIPT>

<body onload=javascript:document.NETSJ_Login.UserName.focus()>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="80">&nbsp;</td>
  </tr>
  <tr>
    <td><table width="400" height="307" border="0" align="center" cellpadding="0" cellspacing="0" background="Images/login.jpg">
      <tr>
        <td height="87" colspan="2">&nbsp;</td>
      </tr>
      <tr>
        <td width="66">&nbsp;</td>
        <td width="334"><br>
            <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
              <form action="?Action=LoginCheck" method="post" onSubmit="return chk(this);" name="NETSJ_Login">
                <tr>
                  <td height="30" align="left">&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td width="80" align="left">登陆名称：</td>
                  <td><input class="inp" name="UserName" type="TEXT" id="UserName"size="18"></td>
                </tr>
                <tr>
                  <td align="left">登陆密码：</td>
                  <td><input class="inp" name="Password" TYPE="PASSWORD" id="Password" size="20"></td>
                </tr>

				<%If CheckManageCode=True Then %>
                <tr>
                  <td> 认 证 码：</td>
                  <td>
				  <input  size='9' maxlength='20' class="inp"  name="CheckManageCode" type="text" id="CheckManageCode" >
					
					  </td>
                </tr>
				<%End If %>



				<%If CheckCode=True Then %>
                <tr>
                  <td> 验 证 码：</td>
                  <td><input  size='9' maxlength='4' style=" border:1px #84A1BD solid; background-color:#F2FBFF;letter-spacing:2px; padding-left:2px;" name="Code" type="text" id="Code" >
					<img src="../act_inc/code.asp?s='+Math.random();" alt="验证码" title="看不清楚? 换一张！" style="cursor:hand;" onclick="src='../act_inc/code.asp?s='+Math.random()"/>  
					  </td>
                </tr>
				<%End If %>
                <tr>
                  <td>&nbsp;</td>
                  <td><input class="ACT_btn" type="submit" name="submit" value="  登陆  ">
                    &nbsp;
                    <input type="reset"  class="ACT_btn"  name="Submit" value="  取消  "></td>
                </tr>
              </form>
            </table></td>
      </tr>
      <tr>
        <td height="40" colspan="2" align="center">Power by <a href="http://www.actcms.com" target="_blank">ActCMS</a> Copyright 2007-2009
		</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<script language="JavaScript" type="text/JavaScript">
function chk(a)
{
if (a.UserName.value=="")
{
alert ("请输入管理帐号！");
a.UserName.focus();
return false;
}
if (a.Password.value=="")
{alert("请输入管理密码");
a.Password.focus();
return false;
}
<%If CheckCode=True Then %>
if (isNaN(a.Code.value) || a.Code.value.length!=4)
{
alert("验证码输入错误！");
a.Code.focus();
return false;
}
<%End If %>
a.submit.value="提交数据中...";
a.submit.disabled=true;
a.Submit.disabled=true;
}
</script>
</body>
</html>
<% 	End Sub
 %>
