本文整理汇总了PHP中Device::devicekey_session方法的典型用法代码示例。如果您正苦于以下问题:PHP Device::devicekey_session方法的具体用法?PHP Device::devicekey_session怎么用?PHP Device::devicekey_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Device
的用法示例。
在下文中一共展示了Device::devicekey_session方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_device_key
function check_device_key($devicekey)
{
global $mysqli, $redis;
include "Modules/device/device_model.php";
$device = new Device($mysqli, $redis);
$session = $device->devicekey_session($devicekey);
if (empty($session)) {
header($_SERVER["SERVER_PROTOCOL"] . " 401 Unauthorized");
header('WWW-Authenticate: Bearer realm="Device KEY", error="invalid_devicekey", error_description="Invalid device key"');
print "Invalid device key";
$log = new EmonLogger(__FILE__);
$log->error("Invalid device key '" . $devicekey . "'");
exit;
}
return $session;
}
示例2: header
}
}
if ($apikey) {
$session = $user->apikey_session($apikey);
if (empty($session)) {
header($_SERVER["SERVER_PROTOCOL"] . " 401 Unauthorized");
header('WWW-Authenticate: Bearer realm="API KEY", error="invalid_apikey", error_description="Invalid API key"');
print "Invalid API key";
$log = new EmonLogger(__FILE__);
$log->error("Invalid API key '" . $apikey . "'");
exit;
}
} else {
if ($devicekey && @(include "Modules/device/device_model.php")) {
$device = new Device($mysqli, $redis);
$session = $device->devicekey_session($devicekey);
if (empty($session)) {
header($_SERVER["SERVER_PROTOCOL"] . " 401 Unauthorized");
header('WWW-Authenticate: Bearer realm="Device KEY", error="invalid_devicekey", error_description="Invalid device key"');
print "Invalid device key";
$log = new EmonLogger(__FILE__);
$log->error("Invalid device key '" . $devicekey . "'");
exit;
}
} else {
$session = $user->emon_session_start();
}
}
// 4) Language
if (!isset($session['lang'])) {
$session['lang'] = '';