本文整理汇总了PHP中Player::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::getName方法的具体用法?PHP Player::getName怎么用?PHP Player::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
if (strtolower($firstArg) == strtolower($secondArg)) {
return "true";
}
return "false";
}
if (!$logged) {
header("Location: index.php?subtopic=accountmanagement");
}
$player = new Player();
$player->loadByName($_REQUEST['name']);
if ($player->isLoaded()) {
$account = array('sessionKey' => generateSessionKey());
$server = array('WorldID' => 1, 'ip' => $_SERVER['SERVER_ADDR'], 'port' => 7171);
$accountCharacters = "";
foreach ($account_logged->getPlayersList() as $character) {
$accountCharacters .= "<character name='" . htmlspecialchars($character->getName()) . "' worldid='" . $server['WorldID'] . "' selected='" . isSelected($player->getName(), $character->getName()) . "' />";
}
} else {
header("Location: index.php?subtopic=accountmanagement");
}
?>
<html>
<head>
<title>Tibia Flash Client</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="content-language" content="en" />
<link rel="shortcut icon" href="https://a248.e.akamai.net/cipsoft.download.akamai.com/118500/tibia/static.tibia.com/images/global/general/favicon.ico" type="image/x-icon" />
<link rel="icon" href="https://a248.e.akamai.net/cipsoft.download.akamai.com/118500/tibia/static.tibia.com/images/global/general/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="flash-regular-bin/common/style.css" />
示例2: update
public function update(Player $object)
{
$q = "UPDATE " . self::TABLE . " SET `name`='" . Singleton::create("NullConverter")->fromDOMtoDB($object->getName()) . "', `teamId`='" . Singleton::create("NullConverter")->fromDOMtoDB($object->getTeamId()) . "' WHERE playerId='" . addslashes($object->getPlayerId()) . "'";
$pk = $object->getPlayerId();
if ($object->isNew()) {
if (empty($pk)) {
$q = "INSERT INTO " . self::TABLE . " (`name`, `teamId`) VALUES ('" . Singleton::create("NullConverter")->fromDOMtoDB($object->getName()) . "', '" . Singleton::create("NullConverter")->fromDOMtoDB($object->getTeamId()) . "')";
} else {
$q = "INSERT INTO " . self::TABLE . " (`name`, `teamId`) VALUES ('" . Singleton::create("NullConverter")->fromDOMtoDB($object->getPlayerId()) . "', '" . Singleton::create("NullConverter")->fromDOMtoDB($object->getName()) . "', '" . Singleton::create("NullConverter")->fromDOMtoDB($object->getTeamId()) . "')";
}
}
$this->db->updateQuery($q);
if (empty($pk)) {
$pk = $this->db->selectQuery("SELECT playerId from " . self::TABLE . " ORDER BY playerId DESC limit 1")->getSingleton();
}
$result = $this->findByPrimaryKey($pk);
parent::$dbCache->resetEntity("Player");
parent::$dbCache->setSingle("Player", $pk, $result);
return $result;
}
示例3: Rock
function test_Create_New_Player()
{
$rock = new Rock();
$paper = new Paper();
$scissors = new Scissors();
//Arrange;
$new_Player = new Player('Marika', 25, $rock);
$name = $new_Player->getName();
$age = $new_Player->getAge();
$weapon = $new_Player->getWeapon();
$new_Player->save();
//Act;
$result = [$name, $age, $weapon];
//Assert;
$this->assertEquals(['Marika', 25, $rock], $result);
}
示例4: load
public function load()
{
$this->clear();
// Alfredo Rodriguez (Maryland)
$player = new Player();
$player->setFirstName('Alfredo');
$player->setLastName('Rodriguez');
$player->setHeight(72);
$player->setWeight(180);
$player->setBats('R');
$player->setThrows('R');
$player->setHometown('Oak Hill, Va.');
$player->setCstvId(395839);
$player->setNcaaId(993788);
$player->save();
print_r(sprintf("Created Player: %s (%s)\n", $player->getName(), $player->getId()));
}
示例5: addPlayer
public function addPlayer(Player $player)
{
if (count($this->players) >= $this->maxPlayers) {
if ($player->hasPermission("sg.perks.join-full")) {
// Players who have the correct permissions can join even when arenas are full.
$m = count($this->players);
$kick = array_keys($this->players)[rand(0, $m - 1)];
$this->kickPlayer($this->players[$kick]["obj"], "Making space for " . $player->getName());
} else {
return false;
}
}
$this->players[$player->getName()]["obj"] = $player;
$this->players[$player->getName()]["pos"] = new Vector3($player->getX(), $player->getY(), $player->getZ());
$this->players[$player->getName()]["level"] = $player->getLevel();
$this->players[$player->getName()]["inventory"] = $player->getInventory();
return true;
}
示例6: promote
public function promote(Player $player)
{
$mods = $this->getMods();
$members = $this->getMembers();
foreach ($mods as $key => $mod) {
if ($mod === $player->getName()) {
unset($mods[$key]);
array_push($members, $mod);
$this->mods = implode(",", $mods);
$this->members = implode(",", $members);
$this->storeFac();
return;
}
}
foreach ($this->members as $key => $member) {
if ($member === $player) {
unset($members[$key]);
$this->members = implode(",", $members);
$this->storeFac();
return;
}
}
}
示例7: htmlspecialchars
if ($player->isLoaded()) {
$player_account = $player->getAccount();
if ($account_logged->getId() == $player_account->getId()) {
if ($_POST['changecommentsave'] == 1) {
$player->set("hide_char", $new_hideacc);
$player->set("comment", $new_comment);
$player->save();
$main_content .= '<div class="TableContainer" > <table class="Table1" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url(' . $layout_name . '/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightTop" style="background-image:url(' . $layout_name . '/images/content/box-frame-edge.gif);" /></span> <span class="CaptionBorderTop" style="background-image:url(' . $layout_name . '/images/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url(' . $layout_name . '/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >Character Information Changed</div> <span class="CaptionVerticalRight" style="background-image:url(' . $layout_name . '/images/content/box-frame-vertical.gif);" /></span> <span class="CaptionBorderBottom" style="background-image:url(' . $layout_name . '/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url(' . $layout_name . '/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url(' . $layout_name . '/images/content/box-frame-edge.gif);" /></span> </div> </div> <tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><tr><td>The character information has been changed.</td></tr> </table> </div> </table></div></td></tr><br><center><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url(' . $layout_name . '/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url(' . $layout_name . '/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="' . $layout_name . '/images/buttons/_sbutton_back.gif" ></div></div></td></tr></form></table></center>';
} else {
$main_content .= 'Here you can see and edit the information about your character.<br/>If you do not want to specify a certain field, just leave it blank.<br/><br/><form action="?subtopic=accountmanagement&action=changecomment" method="post" ><div class="TableContainer" > <table class="Table5" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url(' . $layout_name . '/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightTop" style="background-image:url(' . $layout_name . '/images/content/box-frame-edge.gif);" /></span> <span class="CaptionBorderTop" style="background-image:url(' . $layout_name . '/images/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url(' . $layout_name . '/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >Edit Character Information</div> <span class="CaptionVerticalRight" style="background-image:url(' . $layout_name . '/images/content/box-frame-vertical.gif);" /></span> <span class="CaptionBorderBottom" style="background-image:url(' . $layout_name . '/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url(' . $layout_name . '/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url(' . $layout_name . '/images/content/box-frame-edge.gif);" /></span> </div> </div> <tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><tr><td><div class="TableShadowContainerRightTop" > <div class="TableShadowRightTop" style="background-image:url(' . $layout_name . '/images/content/table-shadow-rt.gif);" ></div></div><div class="TableContentAndRightShadow" style="background-image:url(' . $layout_name . '/images/content/table-shadow-rm.gif);" > <div class="TableContentContainer" > <table class="TableContent" width="100%" ><tr><td class="LabelV" >Name:</td><td style="width:80%;" >' . htmlspecialchars($player_name) . '</td></tr><tr><td class="LabelV" >Hide Account:</td><td>';
if ($player->getCustomField("hide_char") == 1) {
$main_content .= '<input type="checkbox" name="accountvisible" value="1" checked="checked">';
} else {
$main_content .= '<input type="checkbox" name="accountvisible" value="1" >';
}
$main_content .= ' check to hide your account information</td></tr> </table> </div></div><div class="TableShadowContainer" > <div class="TableBottomShadow" style="background-image:url(' . $layout_name . '/images/content/table-shadow-bm.gif);" > <div class="TableBottomLeftShadow" style="background-image:url(' . $layout_name . '/images/content/table-shadow-bl.gif);" ></div> <div class="TableBottomRightShadow" style="background-image:url(' . $layout_name . '/images/content/table-shadow-br.gif);" ></div> </div></div></td></tr><tr><td><div class="TableShadowContainerRightTop" > <div class="TableShadowRightTop" style="background-image:url(' . $layout_name . '/images/content/table-shadow-rt.gif);" ></div></div><div class="TableContentAndRightShadow" style="background-image:url(' . $layout_name . '/images/content/table-shadow-rm.gif);" > <div class="TableContentContainer" > <table class="TableContent" width="100%" ><tr><td class="LabelV" ><span >Comment:</span></td><td style="width:80%;" ><textarea name="comment" rows="10" cols="50" wrap="virtual" >' . $player->getCustomField("comment") . '</textarea><br>[max. length: 2000 chars, 50 lines (ENTERs)]</td></tr> </table> </div></div><div class="TableShadowContainer" > <div class="TableBottomShadow" style="background-image:url(' . $layout_name . '/images/content/table-shadow-bm.gif);" ><div class="TableBottomLeftShadow" style="background-image:url(' . $layout_name . '/images/content/table-shadow-bl.gif);" ></div><div class="TableBottomRightShadow" style="background-image:url(' . $layout_name . '/images/content/table-shadow-br.gif);" ></div></div></div></td></tr></td></tr> </table> </div> </table></div></td></tr><br/><table style="width:100%" ><tr align="center" ><td><table border="0" cellspacing="0" cellpadding="0" ><tr><td style="border:0px;" ><input type="hidden" name="name" value="' . htmlspecialchars($player->getName()) . '"><input type="hidden" name="changecommentsave" value="1"><div class="BigButton" style="background-image:url(' . $layout_name . '/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url(' . $layout_name . '/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="' . $layout_name . '/images/buttons/_sbutton_submit.gif" ></div></div></td><tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url(' . $layout_name . '/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url(' . $layout_name . '/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="' . $layout_name . '/images/buttons/_sbutton_back.gif" ></div></div></td></tr></form></table></td></tr></table>';
}
} else {
$main_content .= "Error. Character <b>" . htmlspecialchars($player_name) . "</b> is not on your account.";
}
} else {
$main_content .= "Error. Character with this name doesn't exist.";
}
} else {
$main_content .= "Error. Name contain illegal characters.";
}
}
//### DELETE character from account ###
if ($action == "deletecharacter") {
$player_name = trim($_POST['delete_name']);
$password_verify = trim($_POST['delete_password']);
示例8: RegisterPlayer
public function RegisterPlayer(Player $player)
{
$data = new Config($this->data . "users/" . strtolower($player->getName() . ".yml"), Config::YAML);
$data->set("XP", "0");
$data->save();
}
示例9: Player
$player = new Player();
$player->find($name);
if ($player->isLoaded()) {
$number_of_rows = 0;
$account = $player->getAccount();
$skull = '';
if ($player->getSkull() == 4) {
$skull = "<img style='border: 0;' src='./images/skulls/redskull.gif'/>";
} else {
if ($player->getSkull() == 5) {
$skull = "<img style='border: 0;' src='./images/skulls/blackskull.gif'/>";
}
}
$main_content .= '<table border="0" cellspacing="1" cellpadding="4" width="100%"><tr bgcolor="' . $config['site']['vdarkborder'] . '"><td colspan="2" style="font-weight:bold;color:white">Character Information</td></tr>';
$bgcolor = $number_of_rows++ % 2 == 1 ? $config['site']['darkborder'] : $config['site']['lightborder'];
$main_content .= '<tr bgcolor="' . $bgcolor . '"><td width="20%">Name:</td><td style="font-weight:bold;color:' . ($player->isOnline() ? 'green' : 'red') . '">' . htmlspecialchars($player->getName()) . ' ' . $skull . ' <img src="' . $config['site']['flag_images_url'] . $account->getFlag() . $config['site']['flag_images_extension'] . '" title="Country: ' . $account->getFlag() . '" alt="' . $account->getFlag() . '" />';
if ($player->isBanned() || $account->isBanned()) {
$main_content .= '<span style="color:red">[BANNED]</span>';
}
if ($player->isNamelocked()) {
$main_content .= '<span style="color:red">[NAMELOCKED]</span>';
}
$main_content .= '<br /><img src="' . $config['site']['outfit_images_url'] . '?id=' . $player->getLookType() . '&addons=' . $player->getLookAddons() . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet() . '" alt="" /></td></tr>';
if (in_array($player->getGroup(), $config['site']['groups_support'])) {
$bgcolor = $number_of_rows++ % 2 == 1 ? $config['site']['darkborder'] : $config['site']['lightborder'];
$main_content .= '<tr bgcolor="' . $bgcolor . '"><td>Group:</td><td>' . htmlspecialchars(Website::getGroupName($player->getGroup())) . '</td></tr>';
}
$bgcolor = $number_of_rows++ % 2 == 1 ? $config['site']['darkborder'] : $config['site']['lightborder'];
$main_content .= '<tr bgcolor="' . $bgcolor . '"><td>Sex:</td><td>' . htmlspecialchars($player->getSex() == 0 ? 'female' : 'male') . '</td></tr>';
$bgcolor = $number_of_rows++ % 2 == 1 ? $config['site']['darkborder'] : $config['site']['lightborder'];
$main_content .= '<tr bgcolor="' . $bgcolor . '"><td>Profession:</td><td>' . htmlspecialchars(Website::getVocationName($player->getVocation())) . '</td></tr>';
示例10: Player
<?php
if (!empty($_POST)) {
require_once 'database.php';
require_once 'Player.php';
$data = filter_input_array(INPUT_POST);
try {
$player = new Player($db, $data['playerId']);
$player->recordSpin($data);
} catch (Exception $ex) {
die(json_encode(['error' => $ex->getMessage()]));
}
echo json_encode(['PlayerID' => $player->getId(), 'Name' => $player->getName(), 'Credits' => $player->getCredits(), 'LifetimeSpins' => $player->getLifetimeSpins(), 'LifetimeAverageReturn' => $player->getLifetimeAverageReturn()]);
}
示例11: ConnectionDB
<?php
require_once './lib/player.php';
require_once './lib/connectionDB.php';
session_start();
//Creamos un objeto de bd (Crea la conexión).
$connec = new ConnectionDB();
/*Cada vez que incluyamos este código, se validará si hay una sesión iniciada.
Si no hay sesión iniciada nos redirige al formulario inicial de registro de jugador.*/
if (!isset($_SESSION['player']) && isset($_POST['login'])) {
if (isset($_POST['name']) && isset($_POST['lastname']) && isset($_POST['age'])) {
if ($connec->checkConnection() === 'ok') {
$player = new Player($_POST['name'], $_POST['lastname'], $_POST['age']);
$_SESSION['player'] = $player;
$connec->checkPlayer($player->getName(), $player->getLastName(), $player->getAge());
} else {
//$_SESSION['errorDB'] = "error";
$_SESSION['errorDB'] = $connec;
header('location: index.php');
}
} else {
//Si los datos del formulario no están completos volvemos al formulario inicial de login.
header('location: index.php');
}
}
//Esto sucede cuando venimos del formulario de modificación de datos del usuario.
if (isset($_POST['newdata'])) {
if (isset($_POST['newname']) && isset($_POST['newlastname']) && isset($_POST['newage'])) {
//Extraemos el jugador de la sesión y seteamos los nuevos datos.
$player = $_SESSION['player'];
//Actualizamos la bd con los nuevos datos del jugador.
示例12: importPitchers
public function importPitchers($real = false, $year = 0)
{
if ($real) {
$file = "./web/utilities/bw-pitching.csv";
} else {
$file = "./web/utilities/bw-pitching-test.csv";
}
$row = 0;
if (($handle = fopen($file, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
if ($row) {
if ($data[0] >= $year) {
$player = utf8_encode($data[2]);
$slug = $this->CI->slugify->simple($player);
$player = $this->CI->_player->findOneBySlug($slug);
$team = utf8_encode($data[1]);
$slug = $this->CI->slugify->simple($team);
$team = $this->CI->_team->findOneBySlug($slug);
$year = $data[0];
if ($team) {
if ($player) {
$season = $this->CI->_season->findOneBySourceAndPlayerAndYear('Boydsworld', $player, $year);
$official = $this->CI->_season->findOneBySourceAndPlayerAndYear('Smallball', $player, $year);
}
if (!$season) {
$season = new Season();
}
$num = count($data);
for ($c = 0; $c < $num; $c++) {
$method = 'set' . ucwords($this->pitcher[$c]);
if (method_exists($season, $method)) {
$season->{$method}($data[$c]);
if ($official) {
$official->{$method}($data[$c]);
}
}
}
//print_r($season);
$season->setPlayer(utf8_encode($season->getPlayer()));
$season->setLevel('College');
$season->setLeague('NCAA');
$season->setDivision('D1');
/* Save Player */
if (!$player) {
$player = new Player();
$name = $season->getPlayer();
$name = explode(' ', $name);
if (isset($name[count($name) - 1])) {
$player->setLastName(utf8_encode($name[count($name) - 1]));
}
$name = array_splice($name, 0, count($name) - 1);
$name = implode(' ', $name);
if (isset($name)) {
$player->setFirstName(utf8_encode($name));
}
print_r("Adding Player: " . $team->getName() . ", " . $player->getName() . ", " . $season->getYear() . "\n");
$player->save();
} else {
print_r("Existing Player: " . $team->getName() . ", " . $player->getName() . ", " . $season->getYear() . "\n");
}
$season->setPlayer($player);
$season->setTeam($team);
$season->setSource('Boydsworld');
$season->save();
if (!$official) {
$official = clone $season;
$official->setSource('Smallball');
}
$official->setPlayer($player);
$official->setTeam($team);
$official->save();
$teamOfficial = $this->CI->_season->findOneOfficialByTeamAndYear($team, $season->getYear());
if ($teamOfficial) {
$teamOfficial->addPlayer($player);
$teamOfficial->save();
}
}
// end team
}
// end year
}
//row
$row++;
}
fclose($handle);
}
}
示例13: Player
<?php
if (!defined('INITIALIZED')) {
exit;
}
$player = new Player();
$player->find($_GET['name']);
if ($player->isLoaded()) {
if (!file_exists('cache/signatures/' . $player->getID()) || filemtime('cache/signatures/' . $player->getID()) === false || filemtime('cache/signatures/' . $player->getID()) + 30 < time()) {
$image = imagecreatefrompng('./images/signatures/signature.png');
$color = imagecolorallocate($image, 255, 255, 255);
imagettftext($image, 12, 0, 20, 32, $color, './images/signatures/font.ttf', 'Name:');
imagettftext($image, 12, 0, 70, 32, $color, './images/signatures/font.ttf', $player->getName());
imagettftext($image, 12, 0, 20, 52, $color, './images/signatures/font.ttf', 'Level:');
imagettftext($image, 12, 0, 70, 52, $color, './images/signatures/font.ttf', $player->getLevel() . ' ' . Website::getVocationName($player->getVocation()));
if ($player->getRank()) {
imagettftext($image, 12, 0, 20, 75, $color, './images/signatures/font.ttf', 'Guild:');
imagettftext($image, 12, 0, 70, 75, $color, './images/signatures/font.ttf', $player->getRank()->getName() . ' of the ' . $player->getRank()->getGuild()->getName());
}
imagettftext($image, 12, 0, 20, 95, $color, './images/signatures/font.ttf', 'Last Login:');
imagettftext($image, 12, 0, 100, 95, $color, './images/signatures/font.ttf', $player->getLastLogin() > 0 ? date("j F Y, g:i a", $player->getLastLogin()) : 'Never logged in.');
imagepng($image, 'cache/signatures/' . $player->getID());
imagedestroy($image);
}
header("Content-type: image/png");
echo file_get_contents('cache/signatures/' . $player->getID());
}
exit;
示例14: htmlspecialchars
<!-- 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" />
示例15: Player
$check_name_in_database = new Player();
$check_name_in_database->find($newchar_name);
if ($check_name_in_database->isLoaded()) {
$newchar_errors[] = 'This name is already used. Please choose another name!';
}
$charToEdit = new Player($_REQUEST['player_id']);
if (!$charToEdit->isLoaded()) {
$newchar_errors[] = 'This player does not exist.';
}
if ($charToEdit->isOnline()) {
$newchar_errors[] = 'This player is ONLINE. Logout first.';
} elseif ($account_logged->getID() != $charToEdit->getAccountID()) {
$newchar_errors[] = 'This player is not on your account.';
}
if (empty($newchar_errors)) {
echo 'Name of character <b>' . htmlspecialchars($charToEdit->getName()) . '</b> changed to <b>' . htmlspecialchars($newchar_name) . '</b>';
$charToEdit->setName($newchar_name);
$charToEdit->save();
$account_logged->setCustomField('premium_points', $account_logged->getCustomField('premium_points') - $changeNameCost);
} else {
echo 'Some errors occured:<br />';
foreach ($newchar_errors as $e) {
echo '<li>' . $e . '</li>';
}
echo '<br /><a href="?subtopic=changename"><b>BACK</b></a>';
}
}
} else {
echo 'You don\'t have premium points. You need ' . $changeNameCost . '.';
}
} else {