@define('IN_SCCMS', TRUE);
define('D_BUG', '0');
D_BUG?error_reporting(7):error_reporting(0);
set_magic_quotes_runtime(0);
date_default_timezone_set('PRC');
//error_reporting(E_ALL);
$_SGLOBAL = $_SCONFIG = $_TPL = $_SCOOKIE = $_SMODEL = $_SGET = $_SPOST = array();
session_cache_limiter('private, must-revalidate') ;
$admin_dir = '_sysadmincp_2017.php';//后台路径
$admin_file = '_sysadmincp_2017';//后台文件夹;
$_SGLOBAL['admin_dir'] = $admin_dir;
$_SGLOBAL['admin_file'] = $admin_file;
//程序目录
define('S_ROOT', dirname(__FILE__).DIRECTORY_SEPARATOR);
//基本文件
include_once(S_ROOT."./ver.php");
if(!file_exists(S_ROOT."./data/install.lock")) {
header("Location: install/index.php");//安装
exit();
}
if(!@include_once(S_ROOT."./config.php")) {
header("Location: install/index.php");//安装
exit();
}
include_once(S_ROOT."./function/function_common.php");
include_once(S_ROOT."./function/function_smttpl.php");
//加载商品属性方法
include_once(S_ROOT."./function/function_goods_attr.php");
//时间
$mtime = explode(' ', microtime());
$_SGLOBAL['timestamp'] = $mtime[1];
$_SGLOBAL['supe_starttime'] = $_SGLOBAL['timestamp'] + $mtime[0];
//COOKIE
$prelength = strlen($_SC['cookiepre']);
foreach($_COOKIE as $key => $val) {
if(substr($key, 0, $prelength) == $_SC['cookiepre']) {
$_SCOOKIE[(substr($key, $prelength))] = empty($magic_quote) ? saddslashes($val) : $val;
}
}
//GPC过滤
$magic_quote = get_magic_quotes_gpc();
if(empty($magic_quote)) {
$_GET = saddslashes($_GET);
$_POST = saddslashes($_POST);
}
//链接数据库
dbconnect();
//获取变量
$parsegetvar = empty($_SERVER['QUERY_STRING'])?'':$_SERVER['QUERY_STRING'];
if(!empty($parsegetvar)) {
$parsegetvar = addslashes($parsegetvar);
$_SGET = parseparameter(str_replace(array('/','&','='), '/', $parsegetvar));
}
//初始化
$_SGLOBAL['sc_uid'] = 0;
$_SGLOBAL['sc_username'] = '';
$_SGLOBAL['refer'] = empty($_SERVER['HTTP_REFERER'])?'':$_SERVER['HTTP_REFERER'];
//装载Model
include_once(S_ROOT."./class/class_model.php");
$_SMODEL=new SC_Model();
//缓存文件
if(!@include_once(S_ROOT."./data/data_config.php")) {
include_once(S_ROOT."./function/function_cache.php");
config_cache();
include_once(S_ROOT."./data/data_config.php");
}
include_once(S_ROOT."./data/data_goodscategory.php");
/*include_once(S_ROOT."./data/data_producttype.php");*/
include_once(S_ROOT."./data/data_productbrands.php");
include_once(S_ROOT."./data/data_businessgroup.php");
//统一字符串过滤
include_once(S_ROOT."./function/function_postandget.php");
//装载模块
if (!@include_once(S_ROOT.'./data/data_model.php')) {
include_once(S_ROOT.'./function/function_cache.php');
model_cache();
}
//装载权限
if (!@include_once(S_ROOT.'./data/data_permission.php')) {
include_once(S_ROOT.'./function/function_cache.php');
permission_cache();
}
formhash();
include_once(S_ROOT."./class/class_user.php");//调用户类库
if(empty($_SCONFIG['template'])) {
$_SCONFIG['template'] = 'default';
}
templates();
getmainmenu();
getfriendslink();
$user_islogin=SC_login::islogin();
//echo '
';print_r($cart_public);exit;
/**
* 检测终端是手机、平板、电脑
* @return string
*/
function browserUserAgent()
{
$ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
$iphone = strstr(strtolower($ua), 'mobile');
$android = strstr(strtolower($ua), 'android');
$windowsPhone = strstr(strtolower($ua), 'phone');
function androidTablet($ua)
{
if (strstr(strtolower($ua), 'android')) {
if (!strstr(strtolower($ua), 'mobile')) {
return true;
}
}
}
$androidTablet = androidTablet($ua);
$iPad = strstr(strtolower($ua), 'ipad');
if ($androidTablet || $iPad) {
return 'pad';//平板
} elseif ($iphone && !$iPad || $android && !$androidTablet || $windowsPhone) {
return 'phone';//手机端
} else {
return 'pc';//电脑端
}
}
if($_SGLOBAL['sc_uid']){
$sql="select * from user
where uid=".$_SGLOBAL['sc_uid'];
$query = $_SGLOBAL['db']->query($sql);
$user = $_SGLOBAL['db']->fetch_array($query);
}
//手机站
if (isset($_GET['client'])) {
$_SESSION['client_type'] = $_GET['client'];
ssetcookie('client_type', $_GET['client'], 3600);
}
//kallzyyj(2);exit;
session_start();
//if ((isset($_COOKIE['client_type']) && $_COOKIE['client_type'] == 'phone') || (isset($_SESSION['client_type']) && $_SESSION['client_type'] == 'phone') || browserUserAgent() != 'pc') {
// $_TPL->template_dir = S_ROOT . "./templates/app";
// $_SCONFIG['template'] = "app";
//}
一键复制
编辑
Web IDE
原始数据
按行查看
历史