当前位置: 首页>>代码示例>>PHP>>正文


PHP Mysql::debug方法代码示例

本文整理汇总了PHP中Mysql::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP Mysql::debug方法的具体用法?PHP Mysql::debug怎么用?PHP Mysql::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mysql的用法示例。


在下文中一共展示了Mysql::debug方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 private function __construct()
 {
     $debug_key = $this->getDebugKey();
     $this->user_agent = empty($_SERVER['HTTP_USER_AGENT']) ? '' : $_SERVER['HTTP_USER_AGENT'];
     if (!empty($_SERVER['HTTP_X_USER_AGENT'])) {
         $this->user_agent .= '; ' . $_SERVER['HTTP_X_USER_AGENT'];
     }
     $this->parseAuthorizationHeader();
     if (!empty($debug_key) && $this->checkDebugKey($debug_key)) {
         if (!empty($_REQUEST['mac'])) {
             $this->mac = @htmlspecialchars(trim(urldecode($_REQUEST['mac'])));
         } elseif (!empty($_COOKIE['mac'])) {
             $this->mac = @htmlspecialchars(trim(urldecode($_COOKIE['mac'])));
         } else {
             echo 'Identification failed';
             exit;
         }
         if (!empty($_COOKIE['debug']) || !empty($_REQUEST['debug'])) {
             Mysql::$debug = true;
         }
     } else {
         if (!empty($_COOKIE['mac']) && empty($_COOKIE['mac_emu'])) {
             $this->mac = @htmlspecialchars(trim(urldecode($_COOKIE['mac'])));
             if (!empty($_REQUEST['action']) && $_REQUEST['action'] != 'handshake' && $_REQUEST['action'] != 'get_profile' && $_REQUEST['action'] != 'get_localization' && $_REQUEST['action'] != 'do_auth' && !$this->isValidAccessToken($this->access_token)) {
                 error_log("STB authorization failed. MAC: " . $this->mac . ", token: " . $this->access_token);
                 echo 'Authorization failed.';
                 exit;
             }
         } else {
             if (!empty($_SERVER['TARGET']) && ($_SERVER['TARGET'] == 'API' || $_SERVER['TARGET'] == 'ADM') || !empty($_REQUEST['type']) && $_REQUEST['type'] == 'stb') {
             } else {
                 $this->mac = '';
                 echo 'Unauthorized request.';
                 exit;
             }
         }
     }
     $this->mac = strtoupper($this->mac);
     if (!empty($_COOKIE['stb_lang'])) {
         $this->stb_lang = @trim(urldecode($_COOKIE['stb_lang']));
     }
     if (!empty($_COOKIE['timezone']) && $_COOKIE['timezone'] != 'undefined') {
         $this->timezone = @trim($_COOKIE['timezone']);
     }
     if (@$_SERVER['HTTP_X_REAL_IP']) {
         $this->ip = @$_SERVER['HTTP_X_REAL_IP'];
     } else {
         $this->ip = @$_SERVER['REMOTE_ADDR'];
     }
     $this->db = Mysql::getInstance();
     try {
         $this->getStbParams();
     } catch (MysqlException $e) {
         echo $e->getMessage() . PHP_EOL;
         return;
     }
     if (!empty($_COOKIE['mac']) && (empty($this->id) || $this->params['status'] == 1) && !empty($_REQUEST['action']) && $_REQUEST['action'] != 'handshake' && $_REQUEST['action'] != 'get_profile' && $_REQUEST['action'] != 'get_localization' && $_REQUEST['action'] != 'do_auth') {
         error_log("Access denied to " . $_REQUEST['type'] . ":" . $_REQUEST['action'] . " for MAC: " . $this->mac);
         echo 'Access denied.';
         exit;
     }
     if (empty($this->id)) {
         $this->initLocale($this->stb_lang);
         if (!empty($_COOKIE['mac']) && !empty($_REQUEST['action']) && $_REQUEST['action'] != 'handshake' && $_REQUEST['action'] != 'get_profile' && $_REQUEST['action'] != 'get_localization' && $_REQUEST['action'] != 'do_auth' && $_REQUEST['action'] != 'get_events') {
             error_log("STB not found in the database, authorization failed. MAC: " . $this->mac . ", token: " . $this->access_token);
             echo 'Authorization failed.';
             exit;
         }
     }
 }
开发者ID:macblizzard,项目名称:stalker_portal,代码行数:70,代码来源:stb.class.php

示例2: setDebugMode

 /**
  * 设置是否为调试模式
  */
 public function setDebugMode($mode = true)
 {
     return $mode == true ? self::$debug = true : (self::$debug = false);
 }
开发者ID:skschoo1,项目名称:framework,代码行数:7,代码来源:Mysql.php


注:本文中的Mysql::debug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。