class.core.php中
global $_G;
$_G = array(
‘uid‘ => 0,
‘username‘ => ‘‘,
‘adminid‘ => 0,
‘groupid‘ => 1,
‘sid‘ => ‘‘,
‘formhash‘ => ‘‘,
‘timestamp‘ => TIMESTAMP,
‘starttime‘ => dmicrotime(),
‘clientip‘ => $this->_get_client_ip(),
‘referer‘ => ‘‘,
‘charset‘ => ‘‘,
‘gzipcompress‘ => ‘‘,
‘authkey‘ => ‘‘,
‘timenow‘ => array(),
‘PHP_SELF‘ => ‘‘,
‘siteurl‘ => ‘‘,
‘siteroot‘ => ‘‘,
‘siteport‘ => ‘‘,
‘config‘ => array(),
‘setting‘ => array(),
‘member‘ => array(),
‘group‘ => array(),
‘cookie‘ => array(),
‘style‘ => array(),
‘cache‘ => array(),
‘session‘ => array(),
‘lang‘ => array(),
‘my_app‘ => array(),
‘my_userapp‘ => array(),
‘fid‘ => 0,
‘tid‘ => 0,
‘forum‘ => array(),
‘thread‘ => array(),
‘rssauth‘ => ‘‘,
‘home‘ => array(),
‘space‘ => array(),
‘block‘ => array(),
‘article‘ => array(),
‘action‘ => array(
‘action‘ => APPTYPEID,
‘fid‘ => 0,
‘tid‘ => 0,
),
‘mobile‘ => ‘‘,
);
$this->var = & $_G; //重点,全文都是利用var进行赋植
还有就是MAGIC_QUOTES_GPC是否开启,加转义
if(!MAGIC_QUOTES_GPC) {
$_GET = daddslashes($_GET);
$_POST = daddslashes($_POST);
$_COOKIE = daddslashes($_COOKIE);
$_FILES = daddslashes($_FILES);
}
$prelength = strlen($this->config[‘cookie‘][‘cookiepre‘]);
foreach($_COOKIE as $key => $val) {
if(substr($key, 0, $prelength) == $this->config[‘cookie‘][‘cookiepre‘]) {
$this->var[‘cookie‘][substr($key, $prelength)] = $val;
}
}
if($_SERVER[‘REQUEST_METHOD‘] == ‘POST‘ && !empty($_POST)) {
$_GET = array_merge($_GET, $_POST);
}
foreach($_GET as $k => $v) {
$this->var[‘gp_‘.$k] = $v; //所以其他脚本使用变量时,都有gp_
}