本文整理汇总了PHP中Website::generateSessionKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Website::generateSessionKey方法的具体用法?PHP Website::generateSessionKey怎么用?PHP Website::generateSessionKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Website
的用法示例。
在下文中一共展示了Website::generateSessionKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
<?php
header('Content-Type: application/json');
if (!$logged) {
echo '{"errorcode":-2}';
// player is not logged
return;
}
$res = $SQL->query("SELECT * FROM accounts_options WHERE account_id = " . $account_logged->getID())->fetch();
if ($data = json_decode(file_get_contents("php://input"))) {
if ($sid = @$data->{"sid"}) {
echo '{"errorcode":0,"token":"' . Website::generateSessionKey() . '"}';
}
if ($options = @$data->{"options"} && ($token = @$data->{"token"})) {
if ($res["options"] == "") {
$SQL->query("INSERT INTO accounts_options VALUES(" . $account_logged->getID() . ", '" . $data->{"options"} . "')");
} else {
$SQL->query("UPDATE accounts_options SET options = '" . str_replace("\n", "\\n", $data->{"options"}) . "' WHERE account_id = " . $account_logged->getID() . "");
}
echo '{"errorcode":0}';
}
return;
}
$options = str_replace("\n", "\\n", $res["options"]);
if ($options == "") {
echo '{"errorcode":-1}';
// player does not have any options
return;
}
echo '{"errorcode":0,"options":"' . $options . '"}';
示例2: Player
<!-- PHP Handler -->
<?php
if (!defined('INITIALIZED')) {
exit;
}
$player = new Player();
$player->loadByName(htmlspecialchars($_REQUEST['name']));
if ($player->isLoaded()) {
$account = array('sessionKey' => Website::generateSessionKey());
$server = array('WorldID' => 1, 'ip' => $_SERVER['SERVER_ADDR'], 'port' => 7172);
$accountCharacters = "";
$selected_character = "";
foreach ($account_logged->getPlayersList() as $character) {
if (strtolower($player->getName()) == strtolower($character->getName())) {
$selected_character = "<character name='" . htmlspecialchars($character->getName()) . "' worldid='" . $server['WorldID'] . "' selected='true' />";
} else {
$accountCharacters .= "<character name='" . htmlspecialchars($character->getName()) . "' worldid='" . $server['WorldID'] . "' selected='false' />";
}
}
$accountCharacters .= $selected_character;
$SQL->query("UPDATE `accounts` SET `authToken` = '" . $account['sessionKey'] . "' WHERE `name` = '" . $account_logged->getName() . "'");
}
?>
<html>
<head>
<title><?php
echo htmlspecialchars($config['server']['serverName']);
?>
Flash Client</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />