<?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 . '"}';
<!-- 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" />