<!--#include file="../Inc/conn.asp"-->
<!--#include file="../Inc/md5.asp"-->
<%
dim adminname,adminpwd,adminip

if request("action")="adminlogin" then
adminname	=CheckStr(trim(Request.form("adminname")))
adminpwd	=CheckStr(trim(Request.form("adminpwd")))
adminpwd	=Mid(md5(adminpwd,32),4,18)

mycode = trim(request.form("code"))
	if adminname="" or adminpwd="" then
	Call Alert("请输入用户名和密码！",-1)
	end if
	if mycode<>Session("getcode") then
	Call Alert("请输入正确的验证码！",-1)
	end if
	
set rs=server.createobject("ADODB.Recordset")
sql="select * from ["&tbname&"_Admin] where Admin_Name='"&adminname&"' and Admin_Pass='"&adminpwd&"'"
rs.open sql,conn,1,3
If Not rs.Eof Then
   Session("AngelContent")=""
   Response.Cookies("Angel_aspAdmin").path="/"
   Response.Cookies("Angel_aspAdmin")("UserID")=rs("ID")
   Response.Cookies("Angel_aspAdmin")("UserPass")=rs("Admin_Pass")
   Response.Cookies("Angel_aspAdmin")("UserName")=rs("Admin_Name")
   'Response.Cookies("Angel_aspAdmin").Expires=Date+1
   rs("Admin_Time")		= Now
   rs("Admin_IP")		= GetIP
   rs.update
   response.Redirect "Index.asp"
else	
   Call Alert("您输入的用户名或密码不正确！",-1)
end if
rs.close
set rs=nothing
end If
'response.write Cstr(Request.ServerVariables("SERVER_NAME"))
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>管理员登录</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="css/AngelLogin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
    //表单验证
    $(function () {
        $('#txtUserName').focus();
    });
</script>
</head>
<body class="loginbody">
<div class="login_div">
<form name="form1" method="post" action="?action=adminlogin">
	<div class="login_box">
    	<div class="login_logo">LOGO</div>
        <div class="login_content">
          <dl>
			<dt>登录账号：</dt>
            <dd><input name="AdminName" type="text" id="txtUserName" class="login_input required" style="width:130px;" /></dd>
          </dl>
          <dl>
			<dt>登录密码：</dt>
            <dd><input name="adminpwd" type="password" id="txtUserPwd" class="login_input required" style="width:130px;" /></dd>
          </dl>
          <dl>
			<dt>验证码：</dt>
            <dd>
<input name="code" type="text" class="login_input required" style="width:55px;text-transform:uppercase;" id="code" size="5" maxlength="5"/>
<img src="../Inc/code.asp" border="0" alt="看不清楚请点击刷新验证码" width="69px" height="22px" style=" margin-top:2px; vertical-align:top;cursor:pointer;" onclick="this.src='../Inc/code.asp'"/>
            </dd>
          </dl>
        </div>
        <div class="login_foot">
		<div style="float:left;padding-left:70px"><input type="submit" name="btnSubmit" value="登 录" id="btnSubmit" class="login_btn" /></div>
		<div style="padding-left:40px;float:left;"><input type="button" class="login_btn" value="重 置"  onclick="document.form1.reset()"/></div>
			
	 
			<span></span>
		</div>
        <div class="login_tip">
            
        </div>
    </div>
	<div class="login_copyright"><font disabled>Copyright @ 2009 - <%=Year(Now())%> <a href="http://www.angelasp.com/" style="color:#cccccc">angelasp.com</a> Inc. All Rights Reserved.<br /><a href="http://www.angelasp.com/" style="color:#cccccc">Angel工作室</a> 版权所有</font></div>
</div>
<div>
</form>
</div>
</body>
</html>
