本文整理汇总了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;
}
}
}
示例2: setDebugMode
/**
* 设置是否为调试模式
*/
public function setDebugMode($mode = true)
{
return $mode == true ? self::$debug = true : (self::$debug = false);
}