<?php

$mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0];

define('IN_TM', TRUE);
define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
define("_TPLPath_", 'admin/view/');
define("_TPLCachePath_",  'data/admin/');
define("_FORMHASH_", 8);
define("_TPLCacheLimit_",1);// 模板文件缓存有效期
include_once './include/common.inc.php';
session_start(); //要验证SESSION，看是不是管理员

unset($GLOBALS, $_ENV, $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_ENV_VARS);

$_GET     = daddslashes($_GET, 1, TRUE);
$_POST    = daddslashes($_POST, 1, TRUE);
$_COOKIE  = daddslashes($_COOKIE, 1, TRUE);
$_SERVER  = daddslashes($_SERVER);
$_FILES   = daddslashes($_FILES);
$_REQUEST = daddslashes($_REQUEST, 1, TRUE);
$action = getgpc('action');

$act = @in_array($action, array(
'login', 
'logout', 
'about', 
'admin', 
'news', 
'config', 
'frame', 
'shop',
'upload', 
'job',
'ads', 
'guestbook', 
'order', 
'link')) ? $action : 'index';
include_once TM_ROOT.'./admin/'.$act.'.php';

$mtime = explode(' ', microtime());
$endtime = $mtime[1] + $mtime[0];
$endtime = number_format($endtime - $starttime, 5);
function daddslashes($string, $force = 0, $strip = FALSE) {
	if(!MAGIC_QUOTES_GPC || $force) {
		if(is_array($string)) {
			foreach($string as $key => $val) {
				$string[$key] = daddslashes($val, $force, $strip);
			}
		} else {
			$string = addslashes($strip ? stripslashes($string) : $string);
		}
	}
	return $string;
}

function getgpc($k, $var='R') {
	switch($var) {
		case 'G': $var = &$_GET; break;
		case 'P': $var = &$_POST; break;
		case 'C': $var = &$_COOKIE; break;
		case 'R': $var = &$_REQUEST; break;
	}
	return isset($var[$k]) ? $var[$k] : NULL;
}
?>