本文整理汇总了PHP中security::checkSessionToken方法的典型用法代码示例。如果您正苦于以下问题:PHP security::checkSessionToken方法的具体用法?PHP security::checkSessionToken怎么用?PHP security::checkSessionToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类security
的用法示例。
在下文中一共展示了security::checkSessionToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exit
<?php
include './general.php';
include './security.php';
include './sqli.php';
$headers = apache_request_headers();
if (!isset($headers['username']) or !isset($headers['token'])) {
exit('API Error: Username or Access Token Missing');
}
$security = new security($db, $headers['username']);
$security->checkSessionToken($headers['token']);
$method = $_SERVER['REQUEST_METHOD'];
if (isset($_GET['function']) or isset($_POST['function'])) {
$function = isset($_GET['function']) ? $_GET['function'] : $_POST['function'];
} else {
$inputVars = get_object_vars(json_decode(file_get_contents("php://input")));
if (!isset($inputVars['function'])) {
exit('API Error: Function not given');
}
$function = $inputVars['function'];
}
if (!in_array($method, array('GET', 'POST', 'PUT', 'DELETE'))) {
exit("API Error: Invalid Request Method: [{$_SERVER['REQUEST_METHOD']}]");
}
$requestFile = __DIR__ . '/api/' . $function . '.php';
if (!is_file($requestFile)) {
exit("API Error 404: page not found: [{$requestFile}]");
}
if ($method == 'GET') {
$params = $_GET;
} elseif ($method == 'POST') {
示例2: json_encode
}
}
}
return $result;
}
?>
<script>
window.context = {};
window.username = '<?php
echo $_POST['username'];
?>
';
window.token = <?php
$s = new security($db, $_POST['username']);
echo "'" . addslashes($s->checkSessionToken($_POST['token'])) . "'";
?>
window.panePre = <?php
print json_encode(dirToArray('panes'));
?>
;
</script>
</head>
<body id='main' class='unselectable'>
<div id='nav'></div>
<div id='addTab' class='addTab plusTab'>☩</div>
<div id='leftTab' class='addTab leftTab'><</div>
<div id='righTab' class='addTab righTab'>></div>
<div id='header'>
<span id='logout' class='headerItem'>Log Out</span>