示例#1
0
文件: nc.php 项目: my1977/shopnc
 public static function showpage($page_name = "", $layout = "", $time = 2000)
 {
     self::getinstance();
     if (!empty(self::$tpl_dir)) {
         $tpl_dir = self::$tpl_dir . DS;
     } else {
         $tpl_dir = DS;
     }
     if (empty($layout)) {
         $layout = "layout" . DS . self::$layout_file . ".php";
     } else {
         $layout = "layout" . DS . $layout . ".php";
     }
     if (defined("ProjectName") && ProjectName != "") {
         if (defined("NC_ADMIN") && NC_ADMIN === TRUE) {
             $tpl_file = BasePath . DS . ProjectName . DS . "templates" . DS . $tpl_dir . $page_name . ".php";
             $layout_file = BasePath . DS . ProjectName . DS . "templates" . DS . $layout;
         } else {
             $tpl_file = BasePath . DS . ProjectName . DS . "templates" . DS . TPL_NAME . DS . $page_name . ".php";
             $layout_file = BasePath . DS . ProjectName . DS . "templates" . DS . TPL_NAME . DS . $layout;
         }
     } else {
         $tpl_file = BasePath . DS . "templates" . DS . TPL_NAME . DS . $tpl_dir . $page_name . ".php";
         $layout_file = BasePath . DS . "templates" . DS . TPL_NAME . DS . $layout;
     }
     if (file_exists($tpl_file)) {
         $output = self::$output_value;
         $output['html_title'] = $output['html_title'] != "" ? $output['html_title'] : $GLOBALS['setting_config']['site_name'];
         $output['seo_keywords'] = $output['seo_keywords'] != "" ? $output['seo_keywords'] : $GLOBALS['setting_config']['site_name'];
         $output['seo_description'] = $output['seo_description'] != "" ? $output['seo_description'] : $GLOBALS['setting_config']['site_name'];
         $output['ref_url'] = getreferer();
         Language::read("common");
         $lang = Language::getlangcontent();
         @header("Content-type: text/html; charset=" . CHARSET);
         if ($layout != "") {
             if (file_exists($layout_file)) {
                 include_once $layout_file;
             } else {
                 $error = "Tpl ERROR:templates" . DS . $layout . " is not exists";
                 throw_exception($error);
             }
         } else {
             include_once $tpl_file;
         }
     } else {
         $error = "Tpl ERROR:templates" . DS . $tpl_dir . $page_name . ".php is not exists";
         throw_exception($error);
     }
 }
 function inoplog($caozuo, $caozuofile, $state, $user)
 {
     $caozuo = insql2(substr($caozuo, 0, 200));
     $caozuofile = insql2(substr($caozuofile, 0, 200));
     $user = $user ? $user : '******';
     $user = htmlspecialchars(insql2(substr($user, 0, 200)));
     $time = gnt();
     $gethost = insql2(substr(gethost(), 0, 20));
     $getlang = insql2(substr(getlang(), 0, 12));
     $getip = insql2(substr(getip(), 0, 15));
     $getport = insql2(substr(getport(), 0, 5));
     $getos = insql2(substr(getos(), 0, 20));
     $getb = getb();
     $getbn = insql2(substr($getb[0], 0, 20));
     $bversion = insql2(substr($getb[1], 0, 12));
     $agent = insql2(substr($_SERVER['HTTP_USER_AGENT'], 0, 255));
     $referer = insql2(substr(getreferer(), 0, 255));
     $sql = "INSERT INTO {$this->Pre}niux_ams_oplog (username,caozuo,state,caozuofile,time,ip,port,os,browse,version,host,lang,referer,agent) VALUES ('{$user}','{$caozuo}','{$state}','{$caozuofile}','{$time}','{$getip}','{$getport}','{$getos}','{$getbn}','{$bversion}','{$gethost}','{$getlang}','{$referer}','{$agent}')";
     $this->uidRst($sql) or exit(mysql_error());
 }
        exit('Request Bad url');
    }
}
// 加载核心函数
require_once SABLOG_ROOT . 'include/func/global.func.php';
$action = addslashes($_POST['action'] ? $_POST['action'] : $_GET['action']);
$php_self = char_cv($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']);
$timestamp = time();
//登陆存活期一个月
$login_life = 2592000;
// 防止 PHP 5.1.x 使用时间函数报错
if (PHP_VERSION > '5.1') {
    @date_default_timezone_set('UTC');
}
define('IS_ROBOT', isrobot());
$referer = getreferer();
// 加载数据库配置信息
require_once SABLOG_ROOT . 'config.php';
// 检查防刷新或代理访问
if ($attackevasive) {
    require_once SABLOG_ROOT . 'include/fense.inc.php';
}
// 加载数据库类
require_once SABLOG_ROOT . 'include/class/mysql.class.php';
// 初始化数据库类
$DB = new DB_MySQL();
$DB->connect($servername, $dbusername, $dbpassword, $dbname, $usepconnect);
unset($servername, $dbusername, $dbpassword, $dbname, $usepconnect);
// 获得IP地址
if (getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'), 'unknown')) {
    $onlineip = getenv('HTTP_CLIENT_IP');
示例#4
0
文件: core.php 项目: my1977/shopnc
function redirect($url = "")
{
    if (empty($url)) {
        if (!empty($_REQUEST['ref_url'])) {
            $url = $_REQUEST['ref_url'];
        } else {
            $url = getreferer();
        }
    }
    header("Location: " . $url);
    exit;
}