<?php
/*
'**************************************************************************************************
' 软件名称: 盘锦DJ舞曲网CMS Content Management PjRen.Net
' 版本编号: Version 2.5
' 盘锦舞曲: http://www.pj57.com
' 官方网站: http://www.pjren.net
' 小说网站: http://www.hx39.com
' 0427DJ网: http://www.0427dj.net
' 官方论坛: http://www.tianjiazhen.com
' 版权所有: 盘锦舞曲开发团队    盘锦人(QQ:814006710)
' 郑重声明:
'    1、任何个人或组织不得在未经授权的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息；
'    2、盘锦网络事业部保留此软件的法律追究权利
'**************************************************************************************************
*/
include "../include/conn.php";
include "../include/function.php";
include "admin_version.php";
?>
<?php
$action=SafeRequest("action","get");
if($action=="log"){
	$S_Name=SafeRequest("S_AdminUserName","post");
	$S_Pass=md5(SafeRequest("S_AdminPassWord","post"));
	$S_Code=SafeRequest("Codes","post");
	$logtime=date("Y-m-d");
//	$UIP=$_SERVER['SERVER_ADDR'];
	if(!empty($_SERVER["HTTP_CLIENT_IP"]))
	   $UIP = $_SERVER["HTTP_CLIENT_IP"];
	else if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
	   $UIP = $_SERVER["HTTP_X_FORWARDED_FOR"];
	else if(!empty($_SERVER["REMOTE_ADDR"]))
	   $UIP = $_SERVER["REMOTE_ADDR"];
	else
 	  $UIP = "无法获取！";

	if($S_Code!=S_CheckCode){
		die("<script>alert('对不起,你输入的认证码错误！');history.back();</script>");
		}
	$sql= "Select S_ID from s_admin where S_AdminUserName='".$S_Name."' and S_AdminPassWord='".$S_Pass."' and S_IsLock=0";
    $S_ID= $db->Getone($sql);//从数据库中返回1
	if($S_ID){
		 $db->query("update s_admin set S_LoginNum =S_LoginNum +1,S_LoginIP='".$UIP."',S_LastLogin ='".$logtime."' where S_ID='".$S_ID."'");
		 $row=$db ->Getrow("Select * from s_admin where S_ID='".$S_ID."' ");
		 setcookie("S_AdminID",$row['S_ID']);
		 setcookie("S_AdminUserName",$row['S_AdminUserName']);
		 setcookie("S_AdminPassWord",md5($row['S_AdminPassWord']));
		 setcookie("S_Permission",$row['S_Permission']);
		 setcookie("S_Login",md5($row['S_ID'].$row['S_AdminUserName'].md5($row['S_AdminPassWord']).$row['S_Permission']));
	     header("Location:index.php");
		// die("<script>window.location='index.php'</'script>");
		}
	else{
		die("<script>alert('登录失败请确认输入的是正确信息以及帐号是否开启!');history.back();</script>");
		}	
	}
elseif($action=="logout"){
	setcookie("S_AdminID","",time()-1);
	setcookie("S_AdminUserName","",time()-1);
	setcookie("S_AdminPassWord","",time()-1);
	setcookie("S_Permission","",time()-1);
	setcookie("S_Login","",time()-1);
	die("<script>window.parent.window.location.href='admin_login.php'</script>");
	}
if(S_IsInstall==0){
	echo "<script>window.location='../install/install.php';</script>";
	}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>盘锦DJ舞曲PHP版<?php echo $S_Version?>后台管理</title>
<meta name="generator" content="chshdjCms" />
<meta name="MSSmartTagsPreventParsing" content="TRUE" />
<meta http-equiv="MSThemeCompatible" content="Yes" />
<link rel="SHORTCUT ICON" href="../favicon.ico" />
<script language = "javaScript" src = "js/Main.js" type="text/javascript"></script>
</head>
<script language="javascript">
  function CheckLogin(){
	  if (this.form1.S_AdminUserName.value==""){
		  document.getElementById("infos").innerHTML="对不起，用户名不能为空！";
		  return false;
		  }
	 else if(this.form1.S_AdminPassWord.value==""){
          document.getElementById("infos").innerHTML="对不起，密码不能为空！";
		  return false;
		 }	
	 else if(this.form1.Codes.value==""){
		  document.getElementById("infos").innerHTML="对不起，认证码不能为空！";
		  return false;
		}
   else{
	   return true;
	   }
	  
	  }
</script>
<body onLoad="if(window.name!=''){document.body.style.width='100%';}">
<div class="menuskin" id="popmenu" onMouseOver="clearhidemenu()" onMouseOut="dynamichide(event)" style="z-index:100;"></div><script language="javascript" type="text/javascript">var boardxml='',ISAPI_ReWrite = 0,forum_picurl='images/skins/';</script>

<style type=text/css>

body {

	background:#CAD7F7; font-size: 12px; margin-top:0px;

	SCROLLBAR-FACE-COLOR: #799AE1; SCROLLBAR-HIGHLIGHT-COLOR: #799AE1; 

	SCROLLBAR-SHADOW-COLOR: #799AE1; SCROLLBAR-DARKSHADOW-COLOR: #799AE1; 

	SCROLLBAR-3DLIGHT-COLOR: #799AE1; SCROLLBAR-ARROW-COLOR: #FFFFFF;

	SCROLLBAR-TRACK-COLOR: #AABFEC;
	font-family:Verdana, Arial, Helvetica, sans-serif;

}

TD {

	FONT-SIZE: 12px

}

INPUT {

	BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 12px; BORDER-BOTTOM-WIDTH: 1px; BORDER-RIGHT-WIDTH: 1px

}

TEXTAREA {

	BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 12px; BORDER-BOTTOM-WIDTH: 1px; BORDER-RIGHT-WIDTH: 1px

}

SELECT {

	BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 12px; BORDER-BOTTOM-WIDTH: 1px; BORDER-RIGHT-WIDTH: 1px

}

SPAN {

	FONT-SIZE: 12px; POSITION: static

}

A {

	COLOR: #000000; TEXT-DECORATION: none

}

A:hover { color:#428EFF;text-decoration:underline; }

A.highlight {

	COLOR: red; TEXT-DECORATION: none

}

A.highlight:hover {

	COLOR: red

}

A.thisclass {

	FONT-WEIGHT: bold; TEXT-DECORATION: none

}

A.thisclass:hover {

	FONT-WEIGHT: bold

}

A.navlink {

	COLOR: #000000; TEXT-DECORATION: none

}

A.navlink:hover {

	COLOR: #003399; TEXT-DECORATION: none

}

.twidth {

	WIDTH: 760px

}

.content {

	FONT-SIZE: 14px; MARGIN: 5px 20px; LINE-HEIGHT: 140%; FONT-FAMILY: Tahoma,宋体

}

.aTitle {

	FONT-WEIGHT: bold; FONT-SIZE: 15px

}

TD.forumHeaderBackgroundAlternate {

	BACKGROUND-IMAGE: url(images/admin_top_bg.gif); COLOR: #000000; BACKGROUND-COLOR: #799ae1

}

#TableTitleLink A:link {

	COLOR: #ffffff; TEXT-DECORATION: none

}

#TableTitleLink A:visited {

	COLOR: #ffffff; TEXT-DECORATION: none

}

#TableTitleLink A:active {

	COLOR: #ffffff; TEXT-DECORATION: none

}

#TableTitleLink A:hover {

	COLOR: #ffffff; TEXT-DECORATION: underline

}

TD.forumRow {

	PADDING-RIGHT: 3px; PADDING-LEFT: 3px; BACKGROUND: #F1F3F5; PADDING-BOTTOM: 3px; PADDING-TOP: 3px

}

TH {

	FONT-WEIGHT: bold; FONT-SIZE: 12px; BACKGROUND-IMAGE: url(images/admin_bg_1.gif); COLOR: white; BACKGROUND-COLOR: #4455aa

}

TD.bodytitle {

	BACKGROUND-IMAGE: url(images/admin_bg_2.gif)

}

TD.bodytitle1 {

	BACKGROUND-IMAGE: url(images/admin_bg_3.gif)

}

TD.tablebody1 {

	PADDING-RIGHT: 3px; PADDING-LEFT: 3px; BACKGROUND: #bebbdb; PADDING-BOTTOM: 3px; PADDING-TOP: 3px

}

TD.forumRowHighlight {

	PADDING-RIGHT: 3px; PADDING-LEFT: 3px; BACKGROUND: #E4EDF9; PADDING-BOTTOM: 3px; PADDING-TOP: 3px

}

.tableBorder {

	BORDER-RIGHT: #183789 1px solid; BORDER-TOP: #183789 1px solid; BORDER-LEFT: #183789 1px solid; WIDTH: 98%; BORDER-BOTTOM: #183789 1px solid; BACKGROUND-COLOR: #ffffff

}

.tableBorder1 {WIDTH: 98%; }

.helplink {

	FONT: 10px verdana,arial,helvetica,sans-serif; CURSOR: help; TEXT-DECORATION: none

}

.copyright {

	PADDING-RIGHT: 1px; BORDER-TOP: #6595d6 1px dashed; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; FONT: 11px verdana,arial,helvetica,sans-serif; COLOR: #4455aa; PADDING-TOP: 1px; TEXT-DECORATION: none

}

.menuskin {

	BORDER: #666666 1px solid; VISIBILITY: hidden; FONT: 12px Verdana;

	POSITION: absolute; 

	BACKGROUND-COLOR:#EFEFEF;

	background-image:url("images/skins/dvmenubg3.gif");

	background-repeat : repeat-y;

	}

.menuskin A {

	PADDING-RIGHT: 10px; PADDING-LEFT: 25px; COLOR: black; TEXT-DECORATION: none; behavior:url(inc/noline.htc);

	}

#mouseoverstyle {

	BACKGROUND-COLOR: #C9D5E7; margin:2px; padding:0px; border:#597DB5 1px solid;

	}

#mouseoverstyle A {

	COLOR: black

}

.menuitems{

	margin:2px;padding:1px;word-break:keep-all;

}

</style>
<style type="text/css">
body { background:#fff; background-image : url("images/skins/body_bg.gif");background-repeat: repeat-x ;  }
td { font-size:12px;}
input { border:1px solid #999; }
.button { color: #135294; border:1px solid #666; height:21px; line-height:18px; background:url("Admin/images/skins/button_bg.gif")}
div#nifty{margin: 0 10%;background: #ABD4EF;width: 420px;word-break:break-all; margin-top:60px;}
b.rtop, b.rbottom{display:block;background: #FFF}
b.rtop b, b.rbottom b{display:block;height: 1px;overflow: hidden; background: #ABD4EF}
b.r1{margin: 0 5px}
b.r2{margin: 0 3px}
b.r3{margin: 0 2px}
b.rtop b.r4, b.rbottom b.r4{margin: 0 1px;height: 2px}
</style>
<center>
<div id="nifty">
<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>
<div style="width:403px; height:26px; line-height:26px; background:none; font-size:12px; text-align:left;">&nbsp; 管理登录</div>
<div style="width:401px !important; width:403px; height:120px; background:#fff; border-left:1px solid #649EB2; border-right:1px solid #649EB2; "><BR>
<table width="100%" border="0" cellspacing="3" cellpadding="0">
<form method="post" name="form1" action="?action=log">
	
	<tr>
		<td width="35%" align="right"><b>用户名：</b></td>
		<td><input  name='S_AdminUserName' type='text' id='login_input1' maxlength='20' style="width:120px; height:20px; color:#006699" /></td>
	</tr>
	<tr>
		<td align="right"><b>密　码：</b></td>
		<td><input  name='S_AdminPassWord'  type='password' id='login_input2' maxLength='20' style="width:120px; height:20px; color:#006699" /></td>
	</tr>
	<tr>
		<td align="right"><b>认证码：</b></td>
		<td><input name='Codes' type="PassWord" id="login_input3" style="width:120px; height:20px; color:#006699" />
		
        </td>
	</tr>
	<tr>
	<td height="38" align="right"></td>
	<td><input  class="button" type="Submit" onClick="return CheckLogin()" name='Submit' value="登 录"/>
	  <input  class="button" type="reset" name="submit2" value="重 置"/></td>
	</tr>
  </form>
</table>
</div>
<div style="width:401px !important; width:403px; height:50px; background:#F7F7E7; border:1px solid #649EB2; border-top:1px solid #ddd; margin-bottom:5px; font-size:12px; line-height:20px; padding-top:13px; color:#649EB2; ">Copyright Right&copy;2012-2012 <a href="http://www.pjren.net/" target="_blank">盘锦DJ舞曲网</a></div>
<b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b>
</div>
</body>
</html>
