本文整理汇总了PHP中SmrSession::updateVar方法的典型用法代码示例。如果您正苦于以下问题:PHP SmrSession::updateVar方法的具体用法?PHP SmrSession::updateVar怎么用?PHP SmrSession::updateVar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmrSession
的用法示例。
在下文中一共展示了SmrSession::updateVar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
<?php
$template->assign('PageTopic', 'Show Map');
if (isset($_REQUEST['game_id'])) {
SmrSession::updateVar('GameID', $_REQUEST['game_id']);
}
if (isset($var['GameID'])) {
$container = create_container('map_show_processing.php');
$container['game_id'] = $var['GameID'];
$PHP_OUTPUT .= create_echo_form($container);
$PHP_OUTPUT .= '<select name="account_id" size="1" id="InputFields">';
$PHP_OUTPUT .= '<option value="0">[Please Select]</option>';
$PHP_OUTPUT .= '<option value="all">All Players</option>';
$db->query('SELECT * FROM player WHERE game_id = ' . $db->escapeNumber($var['GameID']) . ' ORDER BY player_name');
while ($db->nextRecord()) {
$PHP_OUTPUT .= '<option value="' . $db->getField('account_id') . '">' . stripslashes($db->getField('player_name')) . ' (' . $db->getField('player_id') . ')</option>';
}
$PHP_OUTPUT .= '</select> ';
$PHP_OUTPUT .= create_submit('Reveal Map');
$PHP_OUTPUT .= '</form>';
} else {
$PHP_OUTPUT .= create_echo_form(create_container('skeleton.php', 'map_show.php'));
$PHP_OUTPUT .= '<p>Please select a game:</p>';
$PHP_OUTPUT .= '<select name="game_id" size="1" id="InputFields">';
$PHP_OUTPUT .= '<option value="0">[Please Select]</option>';
$db->query('SELECT * FROM game ORDER BY game_id DESC');
while ($db->nextRecord()) {
$PHP_OUTPUT .= '<option value="' . $db->getField('game_id') . '">' . $db->getField('game_name') . '</option>';
}
$PHP_OUTPUT .= '</select> ';
$PHP_OUTPUT .= create_submit('Select');
示例2: get_file_loc
<?php
require_once get_file_loc('SmrAlliance.class.inc');
$template->assign('PageTopic', 'Alliance VS Alliance Rankings');
require_once get_file_loc('menu.inc');
create_ranking_menu(1, 3);
$db2 = new SmrMySqlDatabase();
$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'rankings_alliance_vs_alliance.php';
$PHP_OUTPUT .= create_echo_form($container);
if (isset($_REQUEST['alliancer'])) {
SmrSession::updateVar('alliancer', $_REQUEST['alliancer']);
}
$alliancer = $var['alliancer'];
$PHP_OUTPUT .= '<div align="center">';
$PHP_OUTPUT .= '<p>Here are the rankings of alliances vs other alliances<br />';
$PHP_OUTPUT .= 'Click on an alliances name for more detailed death stats.</p>';
$PHP_OUTPUT .= '<table class="standard" width="95%">';
$PHP_OUTPUT .= '<tr>';
$PHP_OUTPUT .= '<th rowspan="9">Killed</th><th colspan="8">Killers</th></tr><tr><td></td>';
if (empty($alliancer)) {
$alliance_vs = array();
$db->query('SELECT * FROM alliance WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' ORDER BY alliance_kills DESC, alliance_name LIMIT 5');
while ($db->nextRecord()) {
$alliance_vs[] = $db->getField('alliance_id');
}
//$PHP_OUTPUT.=('empty '.$alliancer);
} else {
$alliance_vs = $alliancer;
}
示例3: create_error
// check if we have enough room for the thing we are going to buy
if ($portGood['TransactionType'] == 'Buy' && $amount > $ship->getEmptyHolds()) {
create_error('Scanning your ships indicates you don\'t have enough free cargo bays!');
}
// check if the guy has enough money
if ($portGood['TransactionType'] == 'Buy' && $player->getCredits() < $bargain_price) {
create_error('You don\'t have enough credits!');
}
// get relations for us (global + personal)
$relations = $player->getRelation($port->getRaceID());
if (!isset($var['ideal_price'])) {
SmrSession::updateVar('ideal_price', $port->getIdealPrice($good_id, $portGood['TransactionType'], $amount, $relations));
}
$ideal_price = $var['ideal_price'];
if (!isset($var['offered_price'])) {
SmrSession::updateVar('offered_price', $port->getOfferPrice($ideal_price, $relations, $portGood['TransactionType']));
}
$offered_price = $var['offered_price'];
// nothing should happen here but just to avoid / by 0
if ($ideal_price == 0 || $offered_price == 0) {
create_error('Port calculation error...buy more goods.');
}
// can we accept the current price?
if (!empty($bargain_price) && ($portGood['TransactionType'] == 'Buy' && $bargain_price >= $ideal_price || $portGood['TransactionType'] == 'Sell' && $bargain_price <= $ideal_price)) {
// the url we going to
$container = create_container('skeleton.php');
transfer('ideal_price');
transfer('offered_price');
// base xp is the amount you would get for a perfect trade.
// this is the absolut max. the real xp can only be smaller.
$base_xp = SmrPort::getBaseExperience($amount, $port->getGoodDistance($good_id));
示例4: checkForAttackMessage
function checkForAttackMessage(&$msg)
{
global $db, $player, $template;
$contains = 0;
$msg = str_replace('[ATTACK_RESULTS]', '', $msg, $contains);
if ($contains > 0) {
SmrSession::updateVar('AttackMessage', '[ATTACK_RESULTS]' . $msg);
if (!$template->hasTemplateVar('AttackResults')) {
$db->query('SELECT sector_id,result,type FROM combat_logs WHERE log_id=' . $db->escapeNumber($msg) . ' LIMIT 1');
if ($db->nextRecord()) {
if ($player->getSectorID() == $db->getField('sector_id')) {
$results = unserialize(gzuncompress($db->getField('result')));
$template->assign('AttackResultsType', $db->getField('type'));
$template->assignByRef('AttackResults', $results);
}
}
}
}
}
示例5: htmlspecialchars
<?php
if (!isset($var['alliance_id'])) {
SmrSession::updateVar('alliance_id', $player->getAllianceID());
}
$alliance_id = $var['alliance_id'];
$alliance =& SmrAlliance::getAlliance($alliance_id, $player->getGameID());
$template->assign('PageTopic', $alliance->getAllianceName() . ' (' . $alliance->getAllianceID() . ')');
require_once get_file_loc('menu.inc');
create_alliance_menu($alliance_id, $alliance->getLeaderID());
$container = create_container('alliance_stat_processing.php');
$container['alliance_id'] = $alliance_id;
$form = create_form($container, 'Change');
$role_id = $player->getAllianceRole($alliance->getAllianceID());
$db->query('SELECT * FROM alliance_has_roles WHERE alliance_id = ' . $db->escapeNumber($alliance_id) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND role_id = ' . $db->escapeNumber($role_id));
$db->nextRecord();
$PHP_OUTPUT .= $form['form'];
//$PHP_OUTPUT.=create_echo_form(create_container('alliance_stat_processing.php', ''));
$PHP_OUTPUT .= '<table cellspacing="0" cellpadding="0" class="nobord nohpad">';
if ($db->getBoolean('change_pass')) {
$PHP_OUTPUT .= '<tr><td class="top">Password: </td><td><input type="password" name="password" size="30" value="' . htmlspecialchars($alliance->getPassword()) . '"></td></tr>';
}
if ($db->getBoolean('change_mod') || $account->hasPermission(PERMISSION_EDIT_ALLIANCE_DESCRIPTION)) {
$PHP_OUTPUT .= '<tr><td class="top">Description: </td><td><textarea spellcheck="true" name="description">';
$PHP_OUTPUT .= $alliance->getDescription();
$PHP_OUTPUT .= '</textarea></td></tr>';
}
if ($player->isAllianceLeader()) {
$PHP_OUTPUT .= '<tr><td class="top">IRC Channel: </td><td><input type="text" name="irc" size="30" value="' . htmlspecialchars($alliance->getIrcChannel()) . '"> (For Caretaker and autojoining via chat link - works best if you join the channel using the chat link and type "/autoconnect on" as an op)</td></tr>';
}
if ($db->getBoolean('change_mod')) {
示例6: get_file_loc
<?php
$template->assign('PageTopic', 'Plot A Course');
require_once get_file_loc('menu.inc');
create_nav_menu($template, $player);
$container = array();
$container['url'] = 'course_plot_processing.php';
$container['body'] = '';
$template->assign('PlotCourseFormLink', SmrSession::getNewHREF($container));
$container['url'] = 'course_plot_nearest_processing.php';
$template->assign('PlotNearestFormLink', SmrSession::getNewHREF($container));
if ($ship->hasJump()) {
$container = create_container('sector_jump_processing.php', '');
$container['target_page'] = 'current_sector.php';
$template->assign('JumpDriveFormLink', SmrSession::getNewHREF($container));
}
if (isset($_REQUEST['xtype'])) {
SmrSession::updateVar('XType', $_REQUEST['xtype']);
} else {
if (!isset($var['XType'])) {
SmrSession::updateVar('XType', 'Technology');
}
}
$template->assign('XType', $var['XType']);
$template->assign('AllXTypes', array('Technology', 'Ships', 'Weapons', 'Locations', 'Goods'));
// get saved destinations
$template->assign('StoredDestinations', $player->getStoredDestinations());
$container = create_container('course_destination_button_processing.php');
$container['target_page'] = 'course_plot.php';
$template->assign('ManageDestination', SmrSession::getNewHREF($container));
示例7: array
SmrSession::updateVar('action', 0);
}
$action = $var['action'];
if ($action == 5) {
if (!isset($_REQUEST['id']) && !isset($var['log_ids'])) {
$action = $var['old_action'];
} else {
$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'combat_log_viewer.php';
if (!isset($var['log_ids'])) {
$container['log_ids'] = array_keys($_REQUEST['id']);
sort($container['log_ids']);
$container['current_log'] = 0;
SmrSession::updateVar('log_ids', $container['log_ids']);
SmrSession::updateVar('current_log', 0);
} else {
$container['log_ids'] = $var['log_ids'];
$container['current_log'] = $var['current_log'];
}
$container['action'] = 5;
if ($var['direction']) {
if ($var['direction'] == 1) {
--$container['current_log'];
} else {
++$container['current_log'];
}
}
$display_id = $container['log_ids'][$container['current_log']];
if (count($container['log_ids']) > 1) {
if ($container['current_log'] > 0) {
示例8:
$thisSec =& $thisSec->getNeighbourSector('Right');
}
$mapSectors[$i][$j] =& $thisSec;
}
}
$template->assignByRef('Galaxy', $galaxy);
$template->assignByRef('Galaxies', $galaxies);
$template->assignByRef('MapSectors', $mapSectors);
$template->assignByRef('Message', $var['message']);
SmrSession::updateVar('message', null);
// Only show message once
if (isset($_REQUEST['connect']) && $_REQUEST['connect'] > 0) {
SmrSession::updateVar('conn', $_REQUEST['connect']);
} else {
if (!isset($var['conn'])) {
SmrSession::updateVar('conn', 100);
}
}
$template->assign('Connectivity', $var['conn']);
$container = $var;
$container['url'] = '1.6/universe_create_save_processing.php';
$container['body'] = '1.6/universe_create_sectors.php';
$template->assign('SubmitChangesHREF', SmrSession::getNewHref($container));
$container['submit'] = 'Jump To Galaxy';
$template->assign('JumpGalaxyHREF', SmrSession::getNewHref($container));
$container['submit'] = 'Toggle Link';
$template->assign('ToggleLink', $container);
$container = $var;
$container['body'] = '1.6/universe_create_sector_details.php';
$template->assign('UniGen', $container);
$container = $var;
示例9: SmrMySqlDatabase
<?php
$db2 = new SmrMySqlDatabase();
if (isset($_REQUEST['variable'])) {
SmrSession::updateVar('variable', $_REQUEST['variable']);
}
//split variable to get start and end
list($start, $end) = explode(',', $var['variable']);
if (empty($start) || empty($end) || !is_numeric($start) || !is_numeric($end)) {
create_error('Input was not in the correct format: "' . $var['variable'] . '"');
}
$db->query('SELECT * FROM account WHERE account_id >= ' . $db->escapeNumber($start) . ' AND account_id <= ' . $db->escapeNumber($end) . ' ORDER BY account_id');
$PHP_OUTPUT .= create_table();
$PHP_OUTPUT .= '<tr>';
$PHP_OUTPUT .= '<th align=center>Account_id</th>';
$PHP_OUTPUT .= '<th align=center>Login</th>';
$PHP_OUTPUT .= '<th align=center>eMail</th>';
$PHP_OUTPUT .= '<th align=center>Last IP</th>';
$PHP_OUTPUT .= '<th align=center>Exception</th>';
$PHP_OUTPUT .= '</tr>';
while ($db->nextRecord()) {
$acc_id = $db->getField('account_id');
$PHP_OUTPUT .= '<tr>';
$PHP_OUTPUT .= '<td align=center>' . $acc_id . '</td>';
$PHP_OUTPUT .= '<td align=center>' . $db->getField('login') . '</td>';
$PHP_OUTPUT .= '<td align=center>' . $db->getField('email') . '</td>';
$db2->query('SELECT * FROM account_has_ip WHERE account_id = ' . $db2->escapeNumber($acc_id) . ' ORDER BY time DESC LIMIT 1');
if ($db2->nextRecord()) {
$PHP_OUTPUT .= '<td align=center>' . $db2->getField('ip') . '</td>';
} else {
$PHP_OUTPUT .= '<td align=center>No Last IP</td>';
示例10: create_error
<?php
if (!Globals::isFeatureRequestOpen()) {
create_error('Feature requests are currently not being accepted.');
}
$template->assign('PageTopic', 'Feature Request');
if (!isset($var['Status'])) {
SmrSession::updateVar('Status', 'Opened');
}
$container = $var;
$container['Status'] = 'Implemented';
$template->assign('ViewImplementedFeaturesHref', SmrSession::getNewHREF($container));
$container = $var;
$container['Status'] = 'Opened';
$container['ShowOld'] = true;
$template->assign('ShowOldFeaturesHref', SmrSession::getNewHREF($container));
$container = $var;
$container['Status'] = 'Rejected';
$template->assign('ShowRejectedFeaturesHref', SmrSession::getNewHREF($container));
$showCurrent = (!isset($var['ShowOld']) || $var['ShowOld'] !== true) && $var['Status'] == 'Opened';
$template->assign('ShowCurrent', $showCurrent);
$template->assign('Status', $var['Status']);
if ($var['Status'] != 'Implemented') {
$template->assign('PreviousImplementedTotal', getFeaturesCount('Implemented'));
}
if ($var['Status'] != 'Opened' || !$showCurrent) {
$template->assign('CurrentTotal', getFeaturesCount('Opened', true));
}
if ($var['Status'] != 'Opened' || $showCurrent) {
$template->assign('OldTotal', getFeaturesCount('Opened'));
}
示例11: elseif
<?php
if (!isset($var['GameID'])) {
SmrSession::updateVar('GameID', $player->getGameID());
}
$gameID = $var['GameID'];
if (isset($_REQUEST['min_news'])) {
$min_news = $_REQUEST['min_news'];
}
if (isset($_REQUEST['max_news'])) {
$max_news = $_REQUEST['max_news'];
}
if (empty($min_news) || empty($max_news)) {
$min_news = 1;
$max_news = 50;
} elseif ($min_news > $max_news) {
create_error('The first number must be lower than the second number!');
}
$template->assign('PageTopic', 'Reading The News');
require_once get_file_loc('menu.inc');
create_news_menu($template);
require_once get_file_loc('news.functions.inc');
doBreakingNewsAssign($gameID, $template);
doLottoNewsAssign($gameID, $template);
$template->assign('ViewNewsFormHref', SmrSession::getNewHREF(create_container('skeleton.php', 'news_read.php', array('GameID' => $var['GameID']))));
$db->query('SELECT * FROM news WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND type != \'breaking\' ORDER BY news_id DESC LIMIT ' . ($min_news - 1) . ', ' . ($max_news - $min_news + 1));
if ($db->getNumRows()) {
$NewsItems = array();
while ($db->nextRecord()) {
$NewsItems[] = array('Time' => $db->getField('time'), 'Message' => bbifyMessage($db->getField('news_message')), 'Type' => $db->getField('type'));
}
示例12: USING
<?php
if (isset($_REQUEST['admin_id'])) {
SmrSession::updateVar('admin_id', $_REQUEST['admin_id']);
}
$admin_id = $var['admin_id'];
$template->assign('PageTopic', 'Manage Admin Permissions');
$PHP_OUTPUT .= 'List of Accounts with Permissions:<br /><small>Click for details</small>';
$PHP_OUTPUT .= '<ul>';
$container = create_container('skeleton.php', 'permission_manage.php');
$db->query('SELECT account_id, login
FROM account_has_permission JOIN account USING(account_id)
GROUP BY account_id');
while ($db->nextRecord()) {
$container['admin_id'] = $db->getField('account_id');
$PHP_OUTPUT .= '<li>';
$PHP_OUTPUT .= create_link($container, $db->getField('login'));
$PHP_OUTPUT .= '</li>';
}
$PHP_OUTPUT .= '</ul>';
$PHP_OUTPUT .= '<p> </p>';
// if we don't have an account_id here
// we offer a list to choose
if (empty($admin_id)) {
$PHP_OUTPUT .= 'Select an Account to add Permissions:<br /><br />';
$PHP_OUTPUT .= create_echo_form(create_container('skeleton.php', 'permission_manage.php'));
$PHP_OUTPUT .= '<select name="admin_id">';
$db->query('SELECT account_id, login
FROM account
WHERE validated = ' . $db->escapeBoolean(true) . '
ORDER BY login');
示例13: round
<?php
if (isset($_REQUEST['amount'])) {
SmrSession::updateVar('amount', $_REQUEST['amount']);
}
if (isset($_REQUEST['account_id'])) {
SmrSession::updateVar('account_id', $_REQUEST['account_id']);
}
$amount = $var['amount'];
$account_id = $var['account_id'];
if (!is_numeric($amount)) {
create_error('Numbers only please!');
}
if (!is_numeric($account_id)) {
create_error('Invalid player selected!');
}
$amount = round($amount);
if ($amount <= 0) {
create_error('You can only tranfer a positive amount!');
}
if ($amount > $account->getSmrCredits()) {
create_error('You can\'t transfer more than you have!');
}
$template->assign('PageTopic', 'Confirmation');
$PHP_OUTPUT .= 'Are you sure you want to transfer ' . $amount . ' credits to<br />';
$PHP_OUTPUT .= 'Player with HoF name ' . SmrAccount::getAccount($account_id)->getHofName() . '?<br />';
$PHP_OUTPUT .= '<br/><h3>Please make sure this is definitely the correct person before confirming.</h3>';
$PHP_OUTPUT .= '<p> </p>';
$container = array();
$container['url'] = 'preferences_processing.php';
$container['account_id'] = $account_id;
示例14: elseif
SmrSession::updateVar('email', '');
}
if (isset($_REQUEST['hofname'])) {
SmrSession::updateVar('hofname', $_REQUEST['hofname']);
} elseif (!isset($var['hofname'])) {
SmrSession::updateVar('hofname', '');
}
if (isset($_REQUEST['player_name'])) {
SmrSession::updateVar('player_name', $_REQUEST['player_name']);
} elseif (!isset($var['player_name'])) {
SmrSession::updateVar('player_name', '');
}
if (isset($_REQUEST['game_id'])) {
SmrSession::updateVar('SearchGameID', $_REQUEST['game_id']);
} elseif (!isset($var['SearchGameID'])) {
SmrSession::updateVar('SearchGameID', 0);
}
if (!empty($var['account_id']) && !is_numeric($var['account_id'])) {
create_error('Account ID must be a number.');
}
$account_id = $var['account_id'];
$player_name = $var['player_name'];
// create account object
$curr_account = false;
if (!empty($player_name) && !is_array($player_name)) {
$gameIDClause = $var['SearchGameID'] != 0 ? ' AND game_id = ' . $db->escapeNumber($var['SearchGameID']) . ' ' : '';
$db->query('SELECT account_id FROM player
WHERE player_name = ' . $db->escapeString($player_name) . $gameIDClause . '
ORDER BY game_id DESC LIMIT 1');
if ($db->nextRecord()) {
$account_id = $db->getInt('account_id');
示例15: bbifyMessage
<?php
$template->assign('PageTopic', 'Report a Message');
if (!isset($var['notified_time'])) {
SmrSession::updateVar('notified_time', TIME);
}
if (empty($var['message_id'])) {
create_error('Please click the small yellow icon to report a message!');
}
// get message form db
$db->query('SELECT message_text
FROM message
WHERE message_id = ' . $db->escapeNumber($var['message_id']));
if (!$db->nextRecord()) {
create_error('Could not find the message you selected!');
}
$PHP_OUTPUT .= 'You have selected the following message:<br /><br />';
//$PHP_OUTPUT.=('<textarea disabled="disabled" id="InputFields" style="width:400px;height:300px;">' . bbifyMessage($db->getField('message_text')) . '</textarea>');
$PHP_OUTPUT .= '<table class="standard"><tr><td>' . bbifyMessage($db->getField('message_text')) . '</td></tr></table>';
$PHP_OUTPUT .= '<p>Are you sure you want to notify this message to the admins?<br />';
$PHP_OUTPUT .= '<small><b>Please note:</b> Abuse of this system could end in disablement<br />Therefore, please only notify if the message is inappropriate</small></p>';
$container = create_container('message_notify_processing.php', '');
transfer('message_id');
transfer('sent_time');
transfer('notified_time');
$PHP_OUTPUT .= create_echo_form($container);
$PHP_OUTPUT .= create_submit('Yes');
$PHP_OUTPUT .= ' ';
$PHP_OUTPUT .= create_submit('No');
$PHP_OUTPUT .= '</form>';