Beispiel #1
0
 private function __construct()
 {
     $config = HaloEnv::getConfig();
     $this->host = $config['log']['host'];
     $this->port = $config['log']['port'];
     $this->prefix = $config['debug'] == 1 ? 'debug_' : '';
 }
Beispiel #2
0
 protected function checkReferer()
 {
     //检查是否是post请求
     if (strcasecmp($_SERVER['REQUEST_METHOD'], 'POST') != 0) {
         $this->inputRefererErrorResult();
     }
     $refer = $_SERVER['HTTP_REFERER'];
     if (empty($refer)) {
         $this->inputRefererErrorResult();
     } else {
         $legalHost = array('weibo.com', 'weibo.cn', 'zhaopin.weibo.cn', 'zhaopin.weibo.com', "pre.zhaopin.weibo.com", "www.zhaopin.weibo.com", "zhaopin.renmai.cn");
         $testHost = array('local.weibo.com', 'local.weibo.cn', 'renmai.weibo.com', 'renmai.weibo.cn', 'renmai.cn', 'fix.zhaopin.weibo.com', 'dev.zhaopin.weibo.com', 'local.zhaopin.weibo.com', "pre.zhaopin.weibo.com", "fix.weizhaopin.com");
         $config = HaloEnv::getConfig();
         if ($config->app->debug == 1) {
             $legalHost = array_merge($legalHost, $testHost);
         }
         $url = parse_url($refer);
         $result = false;
         foreach ($legalHost as $v) {
             //                $pos = stripos($url['host'],$v);
             //                if($pos!==false)
             if ($v == $url['host']) {
                 $result = true;
                 break;
             }
         }
         if ($result === false) {
             $this->inputRefererErrorResult();
         } else {
             if (!$_FILES && $_REQUEST['trace_type'] != 'ajax') {
                 $this->inputRefererErrorResult();
             }
         }
     }
 }