<!--#include file="inc/AspCms_SettingClass.asp" -->
<%
dim action : action=getForm("action","get")
if action = "login" then
	dim UserName,Password,sql,code,Rs,atype
	UserName = filterPara(getForm("username","post"))
	atype = getForm("atype","post")
	Password = md5(getForm("Password","post"),16)
	code     = getForm("code","post")
	if admincode=1 then
		if code <> Session("Code") then	alertMsgAndGo "您填写的验证码错误!","-1"
	end if
	if isOutSubmit then  alertMsgAndGo"非法外部提交被禁止","-1"
	sql = "select count(*) from {prefix}User where LoginName = '"& UserName &"' and Password='"&Password&"'"
	Dim rsObj : Set rsObj=Conn.Exec(sql,"r1")
	if rsObj(0)=1 then
	
		
		Set rsObj=Conn.Exec("select IsAdmin, GroupStatus,GroupName, UserStatus, UserID, GroupMenu,GroupSort, LanguageID,adminrand from {prefix}User as a, {prefix}UserGroup as b where LoginName='"&UserName&"' and a.GroupID=b.GroupID","r1")	
		if not rsObj.Eof Then
			if rsObj("IsAdmin")<>1 then alertMsgAndGo"对不起，你不是管理员！","-1"
			if rsObj("GroupStatus")<>1 then alertMsgAndGo"对不起，您所在用户组已被禁用！","-1"
			if rsObj("UserStatus")<>1 then alertMsgAndGo"对不起，您的账号已被禁用！","-1"
			Session("adminName")=UserName
			Session("GroupName")=rsObj("GroupName")
			'wCookie"adminpwd",getForm("Password","post")
			Session("adminpwd") = getForm("Password","post")
			Session("adminId")=rsObj("UserID")
			Session("groupMenu")=repnull(rsObj("GroupMenu"))
			Session("GroupSort")=repnull(rsObj("GroupSort"))
			'查找
			dim LanguageID
			LanguageID=rsObj("LanguageID")

			if isnul(LanguageID) then 				
				set rs=conn.exec("select LanguageID,LanguagePath,Alias from {prefix}Language where IsDefault=1","exe")
				if rs.eof then					
					echoErr err_15,15,"没有设置默认语言"
				else
					LanguageID=rs(0)
				end if
			else 	
				set rs=conn.exec("select LanguageID,LanguagePath,Alias from {prefix}Language where LanguageID="&LanguageID,"exe")				
				LanguageID=rs(0)	
			end if 
			randomize
			dim randnum
			randnum=clng(rnd*99999999)
			Conn.Exec"update {prefix}User set adminrand='"& randnum &"' where UserID="&rsObj("UserID"),"exe"	
			Session("adminrand")=rsObj("adminrand")	
			Session("languageID")=LanguageID			
			Session("LanguagePath")=rs("LanguagePath")
			Session("LanguageAlias")=rs("Alias")
			
			rs.close : set rs=nothing
			Conn.Exec"update {prefix}User set LastLoginTime='"&now()&"',LastLoginIP='"&getIp()&"',LoginCount=LoginCount+1 where UserID="&rsObj("UserID"),"exe"	
			'response.Redirect("index_user.asp")	
			response.Redirect("index.asp")	
		end if
	else
		alertMsgAndGo "用户名或密码错误!","-1"
	end if
	rsObj.Close() : set rsObj=Nothing	
elseif action = "logout" then
	Session("adminName")=""
	Session("adminId")=""
	Session("groupMenu")=""
	Session("SceneMenu")=""
	response.Redirect("login.asp"):response.End()
elseif action = "relog" then
	alertMsgAndGo "对不起,您的登录状态已经失效,请重新登录!","login.asp"
end if
%>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="肖登天[QQ：853616368]">
<title>网站CMS后台管理系统</title>
<style>
body {
	background: #E8E9EE;
	font-family: "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei", "\9ED1\4F53", Arial, sans-serif;
	color: #000;
	font-size: 16px;
}
* {
	padding: 0px;
	margin: 0px;
}
.top_div {
	background: #1B3160;
	width: 100%;
	height: auto;
	min-height:280px;
	margin:0;
	padding-top:90px;
}
.ipt {
	border: 1px solid #000;
	padding: 10px 20px;
	width: 80%;
	border-radius: 5px;
	-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
	box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
	-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
	-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
	transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s
}

.u_logo {
	background: url("images/username.png") #fff no-repeat center left;
}
.p_logo {
	background: url("images/password.png") #fff no-repeat center left;
}
a {
	text-decoration: none;
}
.tou {
	background: url("images/tou.png") no-repeat;
	width: 97px;
	height: 92px;
	position: absolute;
	top: -87px;
	left: 140px;
}
.left_hand {
	background: url("images/left_hand.png") no-repeat;
	width: 32px;
	height: 37px;
	position: absolute;
	top: -38px;
	left: 150px;
}
.right_hand {
	background: url("images/right_hand.png") no-repeat;
	width: 32px;
	height: 37px;
	position: absolute;
	top: -38px;
	right: -64px;
}
.initial_left_hand {
	background: url("images/hand.png") no-repeat;
	width: 30px;
	height: 20px;
	position: absolute;
	top: -12px;
	left: 100px;
}
.initial_right_hand {
	background: url("images/hand.png") no-repeat;
	width: 30px;
	height: 20px;
	position: absolute;
	top: -12px;
	right: -112px;
}
.left_handing {
	background: url("images/left-handing.png") no-repeat;
	width: 30px;
	height: 20px;
	position: absolute;
	top: -24px;
	left: 139px;
}
.right_handinging {
	background: url("images/right_handing.png") no-repeat;
	width: 30px;
	height: 20px;
	position: absolute;
	top: -21px;
	left: 210px;
}
.submit {
	background: rgb(0, 142, 173);
	padding: 7px 10px;
	border-radius: 4px;
	border: 1px solid rgb(26, 117, 152);
	border-image: none;
	color: rgb(255, 255, 255);
	font-weight: bold;
	margin:10px 0;
}
.line{border-top-color: rgb(231, 231, 231); border-top-width: 1px; border-top-style: solid;}
.copyright{ text-align:center; margin:20px auto}
body,td,th {
	font-family: "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei", \9ED1\4F53, Arial, sans-serif;
}
</style>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
	//得到焦点
	$("#password").focus(function(){
		$("#left_hand").animate({
			left: "150",
			top: " -38"
		},{step: function(){
			if(parseInt($("#left_hand").css("left"))>140){
				$("#left_hand").attr("class","left_hand");
			}
		}}, 2000);
		$("#right_hand").animate({
			right: "-64",
			top: "-38px"
		},{step: function(){
			if(parseInt($("#right_hand").css("right"))> -70){
				$("#right_hand").attr("class","right_hand");
			}
		}}, 2000);
	});
	//失去焦点
	$("#password").blur(function(){
		$("#left_hand").attr("class","initial_left_hand");
		$("#left_hand").attr("style","left:100px;top:-12px;");
		$("#right_hand").attr("class","initial_right_hand");
		$("#right_hand").attr("style","right:-112px;top:-12px");
	});
});
</script>
</head>
<body>
<div class="top_div"><h1 style="width:100%; height:50px; line-height:50px; color:#ddd492; text-align:center;">网 站 后 台 管 理 系 统</h1></div>
<div style="background:#E6F1F1; margin:-100px auto 0 auto; border:2px solid #3B3B4B; border-radius:10px; width:90%; max-width:400px; height:220px; text-align: center;">
  <div style="width: 165px; height: 96px; position: absolute;">
    <div class="tou"></div>
    <div class="initial_left_hand" id="left_hand"></div>
    <div class="initial_right_hand" id="right_hand"></div>
  </div>
<form method="post" action="?action=login" onSubmit="writeCookie('username',this.username.value, 1)">
    <p style="padding: 30px 0px 10px; position: relative;">
      <input name="username" class="ipt u_logo" type="text" placeholder="请输入用户名" value="">
    </p>
    <p style="position: relative;">
      <input name="Password" class="ipt p_logo" id="password" type="password" placeholder="请输入密码" value="">
    </p>
    <div class="line" style="height: 50px; line-height: 50px; margin-top: 30px; ">
      <p style="margin: 0px 10px 20px 20px;"><span style="float: left;">
        <input type="text" id="code" name="code"  class="ipt"  maxlength="4" placeholder="验证码" style="width:60px; padding: 8px 5px;">
        <img src="../inc/checkcode.asp" align="absmiddle" style="cursor:pointer; height:26px; width:auto; vertical-align:middle; margin:auto 0;" border="0" alt="验证码" title="看不清？点我刷新！" onClick="this.src='../inc/checkcode.asp?'+Math.random()" /></span> <span style="float: right;">
        <input name="submit" type="submit" value="登陆" class="submit">
        </span> </p>
    </div>
  </form>
</div>
<div class="copyright">Copyright &copy;2012  技术支持：<a href="http://www.urkeji.com/" target="_blank">友软科技</a></div>
</body>
</html>