<!--#include file="Conn.asp"--><%
Act = Request.QueryString("act")
If Act = "logout" Then
Add_Session "loginid",""
Add_Session "loginuser",""
Add_Session "loginname",""
Add_Session "loginpower",""
End If
If Act = "login" Then
CheckPost
loginuser=TextEncode(Request.Form("loginuser"))
loginpwd=TextEncode(Request.Form("loginpwd"))
logincode=Request.Form("logincode")
If loginuser="" Then Response.Write "1":Conn.Close:Set Conn=Nothing:Response.End
If loginpwd="" Then Response.Write "2":Conn.Close:Set Conn=Nothing:Response.End
If logincode<>Session("zengscode") Then Response.Write "3":Conn.Close:Set Conn=Nothing:Response.End
Set Rs=Server.CreateObject("ADODB.RecordSet")
Rs.Open "Select id,loginuser,loginpwd,loginstate,loginname,loginlasttime,loginlastip,loginthistime,loginthisip,loginpower,logincount From login Where loginuser='"&loginuser&"'",conn,1,3
If Rs.Recordcount=0 Then Response.Write "4":Rs.Close:Set Rs=Nothing:Conn.Close:Set Conn=Nothing:Response.End
If Rs(2)<>MD5(loginpwd) Then Response.Write "5":Rs.Close:Set Rs=Nothing:Conn.Close:Set Conn=Nothing:Response.End
If Rs(3)<1 Then Response.Write "6":Rs.Close:Set Rs=Nothing:Conn.Close:Set Conn=Nothing:Response.End
If Conn.Execute("Select count(powerstate) From power Where id="&Rs(9))(0)=0 Then Response.Write "6":Rs.Close:Set Rs=Nothing:Conn.Close:Set Conn=Nothing:Response.End
If Conn.Execute("Select powerstate From power Where id="&Rs(9))(0)=0 Then Response.Write "6":Rs.Close:Set Rs=Nothing:Conn.Close:Set Conn=Nothing:Response.End
Session("zengscode")=""
Rs(5)=Rs(7):Rs(6)=Rs(8):Rs(7)=Now():Rs(8)=GetIp:Rs(10)=Rs(10)+1:Rs.Update
Add_Session "loginid",Rs(0)
Add_Session "loginuser",Rs(1)
Add_Session "loginname",Rs(4)
Add_Session "loginpower",Rs(9)
Response.Write "7":Rs.Close:Set Rs=Nothing:Conn.Close:Set Conn=Nothing:Response.End
Response.End
End If
%><!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link href="css/loginlayout.css" type="text/css" rel="stylesheet" />
<title><%=webname%> - 网站后台管理</title>
<script language="javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/loginjs.js"></script>
</head>
<body>
<div id="container">
	<form id="loginform" name="loginform" method="post">
		<div class="loginuser"><label for="loginuser">用户帐号：</label><input type="text" id="loginuser" name="loginuser" maxlength="50" /></div>
		<div class="loginpwd"><label for="loginpwd">用户密码：</label><input type="password" id="loginpwd" name="loginpwd" maxlength="50" /></div>
		<div class="logincode"><label for="logincode">验 证 码：</label><input type="text" id="logincode" name="logincode" maxlength="5" /><span id="showlogincode"></span></div>
		<div><input type="submit" id="loginbtn" name="loginbtn" value="登陆" /></div>
		<div id="formmsg"></div>
	</form>
	<div id="copyright">Copyright © <%=Year(Now())%> NBCHAO.COM All Rights Reserved</div>
</div>
</body>
</html>
<%
Conn.Close:Set Conn=Nothing
%>