<?php
	date_default_timezone_set("Asia/Shanghai");
	ini_set("display_errors","on");
	ini_set("register_globals","off");
	define("rc_soft","jacksq");
	define("webKey","lsdfj#8fdlkn4*3lfd,(*3.");
	$cg['root']=dirname(__FILE__);
	$cg['inc']="/webinc/public";
	$cg['template']='/template';
	$cg['cache']="{$cg['root']}/cache";
	$cg['domain']="http://192.168.15.56:82";
	$path=$cg['root'].$cg['inc'];
	ini_set("session.save_path","{$cg['root']}/session/");
	session_start();
	"http://".$_SERVER['HTTP_HOST']==$cg['domain'] or die("Access Denied");
	header("Content-Type:text/html; charset=utf-8");
	require_once("{$path}/rili.inc.php");
	require_once("{$path}/config.inc.php");
	require_once("{$path}/power.inc.php");
	require_once("{$path}/fun.inc.php");
	require_once("{$path}/user.inc.php");
	require_once("{$path}/db.inc.php");
	require_once("{$path}/model.inc.php");
	
	$db=new db("mysql","localhost","3306","jxc","root","bjgas");
	$db->condb();
	
	//判断登录状态
	if(!checkLogined()){
		if("http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}"!=$cg['domain'] && "http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}"!="{$cg['domain']}/index.php" && "http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}"!="{$cg['domain']}/userlogin.php"){
			header("Refresh:0;url={$cg['domain']}/index.php");
			die();
		}
	}
	if(stripos($cg['uri'],'/index.php')===false && stripos($cg['uri'],"/")===false && stripos($cg['uri'],"\\")===false && stripos($cg['uri'],'userlogin.php')===false && stripos($cg['uri'],'/main.php')===false){
		if(!isset($_REQUEST['action']) || !isset($_REQUEST['mod']) || isNull($_REQUEST['action']) || isNull($_REQUEST['mod'])){
			die("Access Denied222");
		}
		$isRegCom=isRegCom();
		if(!is_array($isRegCom)){
			echo"<center style=\"font-size:16px; font-weight:bold;\">{$isRegCom}</center>";
		}
		if(!power($_REQUEST['mod'],$_REQUEST['action'])){
			echo"<center style=\"font-size:16px; font-weight:bold;\">你无此操作权限，如确需此操作权限，请联系管理员！</center>";
			die();
		}
	}
	if(!get_magic_quotes_gpc()){
		safeRequest($_REQUEST);
		safeRequest($_POST);
		safeRequest($_GET);
	}
?>