<?
session_start();
if($_POST['name']&&$_POST['pass']&&$_POST['imgcode'])
{
	if(strcasecmp($_POST['imgcode'],$_SESSION["imgcode"])!=0)
	{
		@include('inc/login_url.php');
		exit;
	}
	setcookie('tj_name',$_POST['name'],time()+15*24*60*60);
	$post_pass=md5(md5($_POST['pass']).'tueur');
	setcookie('tj_pass',$post_pass,time()+7*24*60*60);
	echo "<script>location.href='index.php'</script>";
}
@include('../config.inc.php');
$sql="select t_pass,t_name from admin_infos";
@$query=mysql_query($sql);
@$row=mysql_fetch_array($query);
$tj_name=$row['t_name'];
$tj_pass=$row['t_pass'];
if($_COOKIE['tj_name']!=$tj_name||$_COOKIE['tj_pass']!=$tj_pass)
{
	@include('inc/login_url.php');
	exit;
}
?>
<!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" />
<title>被黑网站统计系统后台</title>
<link href="js/style.css" rel="stylesheet" type="text/css" />
</head>
<?
include('../config.inc.php');
switch($_GET['t'])
{
	case 'pending':$pending='current';$path='inc/admin_pending.php';
	break;
	case 'del':$del='current';$path='inc/admin_del.php';
	break;
	case 'ip_del':$ip_del='current';$path='inc/admin_ip_del.php';
	break;
	case 'update':$update='current';$path='inc/admin_update.php';
	break;
	case 'links':$links='current';$path='inc/admin_links.php';
	break;
	case 'header':$header='current';$path='inc/admin_header_info.php';
	break;
	case 'footer':$footer='current';$path='inc/admin_footer_info.php';
	break;
	case 'help':$help='current';$path='inc/admin_help.php';
	break;
	default:
	$default='current';$path='inc/admin_default.php';
}
?>
<body>
<div id="top"><h2>管理统计系统</h2>
<div id="topTags">
<ul>
<h2><a href="../index.php">返回网站首页</a></h2>
</ul>
</div>
</div>
<div id="main">
<div id="leftMenu">
<ul>
<li id="<?=$default?>"><a href="index.php">网站信息</a></li>
<li id="<?=$pending?>"><a href="index.php?t=pending">审核黑页</a></li>
<li id="<?=$del?>"><a href="index.php?t=del">删除黑页</a></li>
<li id="<?=$ip_del?>"><a href="index.php?t=ip_del">批量删除</a></li>
<li id="<?=$update?>"><a href="index.php?t=update">更新数据</a></li>
<li id="<?=$header?>"><a href="index.php?t=header">页头信息</a></li>
<li id="<?=$footer?>"><a href="index.php?t=footer">页底信息</a></li>
<li id="<?=$links?>"><a href="index.php?t=links">友情链接</a></li>
<li id="<?=$help?>"><a href="index.php?t=help">关于系统</a></li>
<li><a href="./logout.php">安全退出</a></li>
</ul>
</div>


<div class="content">
<? include($path);?>
</div>
</div><!--/main-->

<div id="footer">
    <div align="center">Copyright &copy; 2012-2014 <a href="http://<?echo $_SERVER['SERVER_NAME'];?>" target="_blank">被黑网站统计系统</a> All Rights Reserved
    </div>
</div>
</body>
</html>