<?php
require 'config.php';
	$conn = mysql_connect($dbhost, $dbuser, $dbpass);
	mysql_select_db($dbname, $conn);          //选择数据库
	mysql_query("set names utf8");
$Ctrl = @$_GET['m'];
$a = @$_GET['a'];
session_start();
$username = @$_SESSION['username'];
//用来判断用户访问的合法性的函数
if(!isset($username)){require 'template/login.html';exit;}
//header("Content-Type:text/html;   charset=gb2312");

$sql = "SELECT * FROM  `".$qz."setting` LIMIT 1";
$rs = mysql_query($sql,$conn);
$sysinfo = mysql_fetch_array($rs);
$custom = $sysinfo["custom"];
$custom = json_decode($custom,true);
$mail = json_decode($sysinfo["mail"],true);
//print_r($mail);
switch ($Ctrl){
	case 'logout':
		unset($_SESSION["username"]);
		//退出登录成功
		header("location:./");die;
		break;
	case 'setpass':
		$templates = "setpass";
		break;
	case 'alist':
		$templates = "alist";
		break;
	case 'content':
		$templates = "content";
		break;
	case 'system':
		$templates = "system";
		break;
	case 'custom':
		$templates = "custom";
		break;
	default:
		$templates = "info";
}

require 'template/main.html';

function Msg($msg){
	echo '<script>alert("'.$msg.'");</script>';
}
function GoUrl($urll){
	echo '<script>window.location.href="'.$urll.'";</script>';
}
function GoBack(){
	echo '<script>history.go(-1);</script>';
}
?>