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


PHP Website::generateSessionKey方法代码示例

本文整理汇总了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 . '"}';
开发者ID:totolol123,项目名称:TFS-Flash,代码行数:30,代码来源:client_options_serverscript.php

示例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" />
开发者ID:totolol123,项目名称:TFS-Flash,代码行数:31,代码来源:play.php


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