<?php
define('IN_SYS',TRUE);
require './admin_config.php';
require '../config.php';
require '../setup.php';
?>
<?php
$pageDo=$_REQUEST["do"];
switch($pageDo){
	case "adminLogin":

		$username=addslashes($_POST["aUSERNAME"]);
		$password=addslashes($_POST["aPASSWORD"]);

		//替换非法字符串
		$password = str_replace("'","",$password);
		$password = str_replace('/"',"",$password);

		if(empty($username) || empty($password))
		{
			OutErrorBack("用户名和密码必须填写！");
			exit;
		}
		$conn = new dbo();
		$sql="select * from ".DB_TablePre."admin where userName='".$username."' and userPassword='".substr(md5($password),8,16)."'";
		$res=$conn->query($sql);
		$rs = mysql_fetch_array($conn->res);
		if(!$rs)
		{
			OutErrorBack("对不起，用户名或密码错误！");
			exit;
		}
		else
		{
			$_SESSION["adminUsr"] = $username;
			$_SESSION["adminPwd"] = $rs["userPassword"];
			header("location: main.php");
			exit();
		}
	break;
	case "adminLogout":
		session_destroy();
		header("location: index.php");
		exit();
	break;
}
?><!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex,nofollow" />
<title>登录-网站管理系统</title>
<link href="templates/admin.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../lib/jquery/jquery.js"></script>
<!--[if lt IE 9]><script src="lib/js/html5shiv.js"></script><![endif]-->
</head>
<body>
<div class="pageAdminIndex">
<div class="wrapperIndex">
<div class="headerIndex"><h1><img src="templates/logo_index.png" alt="网站管理系统" width="188" height="40"></h1></div>
<div class="loginBoxIndex">
<div class="content_l">
<h2>使用您的 管理账户 登录</h2>
<form action="?do=adminLogin" method="post" name="fAdminLogin" id="fAdminLogin" onSubmit="return signinCheck(document.this)">
<dl class="adminLoginDL">
<dt class="t">请输入<span class="font_blue">账号:</span></dt>
<dd class="f"><input name="aUSERNAME" id="aUSERNAME" type="text" class="field_t1"></dd>
<dt class="t">请输入<span class="font_blue">密码:</span></dt>
<dd class="f"><input name="aPASSWORD" id="aPASSWORD" type="password" class="field_t1"></dd>
<dt class="b"><input name="提交" type="submit" class="btn_login0" value="登录"></dt>
<dd class="h">如忘记后台密码或遇到后台操作疑难问题？请<strong><a href="<%=sysSupportUrl%>" target="_blank">联系服务商</a></strong></dd>
</dl>
</form>
</div>
</div>
</div>
</div>
<?php
include("./admin_footer.php")
?>
</body>
</html>