<?php
/**
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://polang.net.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 山东破浪网络科技有限公司 <QQ:2116198029> 破浪分红权返利系统
// +----------------------------------------------------------------------
// | 官方网站：http://fanxian.polang.net.cn/
// +----------------------------------------------------------------------


*/
session_start();

define('START',microtime(true));


define('PATH', substr(dirname(__FILE__), 0, -7));

define('ROOT', TRUE);

if (PHP_VERSION >= '5.1')
{
    date_default_timezone_set('PRC');
}

error_reporting(E_ERROR | E_WARNING | E_PARSE);

if (__FILE__ == '')
{
    die('Fatal error code: 0');
}

set_time_limit(0);

/* 转义 */
function getmagicquotes($array)
{
	if(!get_magic_quotes_gpc())
	{
		if(is_array($array))
		{
			foreach($array as $key => $value) $array[$key] = getmagicquotes($value);
		}
		else
		{
			$array = addslashes($array);
		}
	}
	return $array;
}

//检查和免费注册外部提交的变量
foreach($_REQUEST as $_k=>$_v)
{
	if( strlen($_k)>0 && eregi('^(cfg_|GLOBALS)',$_k) )
	{
		exit('Request var not allow!');
	}
}

foreach(Array('_GET','_POST','_COOKIE') as $_request)
{
	foreach($$_request as $_k => $_v){
		${$_request}[$_k] = getmagicquotes($_v);
	}
}

if (isset($_SERVER['PHP_SELF']))
{
    define('PHP_SELF', $_SERVER['PHP_SELF']);
}
else
{
    define('PHP_SELF', $_SERVER['SCRIPT_NAME']);
}

?>