<!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>
<!--#include file="../Common/Config.asp"-->
<!--#include file="../Common/Function/Function.asp"-->
<!--#include file="../Common/Function/MD5.asp"-->
<%
LoginCheck=Request.cookies(cookkey)("LoginCheck")
If LoginCheck="LoginTrue" Then 
Response.Redirect Web_Root&"Admin/Main"
End If
%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%=web_Name%>后台登陆-JinCMS智能建站管理系统</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#LoginMsg{ color:#F00;}
</style>
<script language="JavaScript" src="js/jquery.js"></script>
<script src="js/cloud.js" type="text/javascript"></script>
<script language="javascript">
	$(function(){
    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
	$(window).resize(function(){  
    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
    })  
});  
</script> 
<script type="text/javascript">
//防止网站被iframe框架挂马
if( window.top == window.self )
{
}
else
{
	window.parent.location.href=window.self.location.href;
}
</script>
<script language="javascript">
function CheckLogin() 
{
	if(document.form.JinName.value.length<=0)
	{
		document.getElementById("LoginMsg").innerHTML = "* 请输入用户名！"
		document.form.JinName.focus();
		return false;
	}
	if(document.form.JinPwd.value.length<=0)
	{
		document.getElementById("LoginMsg").innerHTML = "* 请输入密码！"
		document.form.JinPwd.focus();
		return false;
	}
}
</script>
</head>
<body style="background-color:#1c77ac; background-image:url(images/light.png); background-repeat:no-repeat; background-position:center top; overflow:hidden;">


    <div id="mainBody">
      <div id="cloud1" class="cloud"></div>
      <div id="cloud2" class="cloud"></div>
    </div>  


<div class="logintop">    
    <A href="http://www.xgweb.net" target="_blank"><span>欢迎使用JinCMS智能建站系统</span></A>   
    <ul>
    <li><a href="<%=web_root%>">回首页</a></li>
    <li><a href="http://www.oywork.com" target="_blank">关于</a></li>
    </ul>    
    </div>
    
    <div class="loginbody">
    
    <span class="systemlogo"></span> 
       
    <div class="loginbox">
    <form name="form" action="Index.asp" method="post" onsubmit="return CheckLogin();">
    <ul>
    <li><input name="JinName" type="text" class="loginuser" value="" /></li>
    <li><input name="JinPwd" type="password" class="loginpwd" value="" /></li>
    <li><input name="submit" type="hidden" id="submit" value="jinlogin" />
    <input name="JinSubmit" type="Submit" class="loginbtn" value="登录" /><label id="LoginMsg"><span style="visibility:hidden"><a href="http://www.xgweb.net" target="_blank">www.xgweb.net</a></span></label></li>
    </ul>
    </form>
    
    </div>
    
    </div>
    
    
    
    <div class="loginbm">2015  <a href="http://www.oywork.com" target="_blank">JinCMS</a>. CopyRight</div>
	
    
</body>

</html>

<%
UserIp=getIP() '获取客户端IP

If  Request_Form("submit")="jinlogin"  then
	
	JinName=replace(trim(Request.form("JinName")) ,"'","") 
	JinPwd=replace(trim(Request.form("JinPwd")) ,"'","") 
	''=============检测用户名是否存在
	Set Rsb = Server.CreateObject("ADODB.RecordSet")
	Sqlb="select * from Jin_Admin where AdminID='"&JinName&"' and Lock=False "
	Rsb.open sqlb,conn,1,1
	If Rsb.RecordCount>0 Then
		''=============检测用户密码是否正确
		Set Rs = Server.CreateObject("ADODB.RecordSet")
		Sql="select * from Jin_Admin where AdminID='"&JinName&"' and AdminPwd='"&MD5(JinPwd)&"' "
		Rs.open Sql,conn,1,3
		If Rs.RecordCount>0 Then
			Rs("LastLoginIP")=UserIp                  '最后登陆Ip
			Rs("LastLoginTime")=Now()                 '最后登陆时间
			Rs("LoginNum")=Rs("LoginNum")+1           '登陆次数加1
			'将相应值写入cookies
			Response.cookies(cookkey)("AdminID")=Rs("AdminID")
			Response.cookies(cookkey)("AdminName")=Rs("AdminName")
			Response.cookies(cookkey)("AdminRank")=Rs("AdminRank")
			Response.cookies(cookkey)("LoginCheck")="LoginTrue"
			Response.Cookies(cookkey).Expires=Date+CInt(Web_CookDate)          'Web_CookDate为自定义保留时间（1-365）
			Rs.update
			%>
			<!--script language="javascript" type="text/javascript"> 
			document.getElementById("LoginMsg").innerHTML = "* 登陆成功，正在进入后台管理系统...";
			var second = 1.2; 
			setInterval("redirect()", 1000); 
			function redirect(){ 
			second=--second; 
			if(second<=0) location.href='Main/'; 
			} 
			</script-->
			<%
			Response.Redirect Web_Root&"Admin/Main"
			'Call alertgo1("登陆成功，正在进入后台管理系统...","Main/")
		Else
			%>
			<script language="javascript" type="text/javascript"> 
			document.getElementById("LoginMsg").innerHTML = "* 密码输入错误，请检查后重新输入";
			</script>
			<%
			'Call alertgo("密码输入错误，请检查后重新输入。")
		End If
		Rs.close
		set Rs=nothing
	
	Else
	%>
	<script language="javascript" type="text/javascript"> 
	document.getElementById("LoginMsg").innerHTML = "* 该用户不存在或被锁定，请重新检查。";
	</script>
	<%
	'Call alertgo("该用户不存在或被锁定，请重新检查。")
	End If
	Rsb.close
	set Rsb=nothing
End If

%>
