本文整理汇总了PHP中SmrSession::account_id方法的典型用法代码示例。如果您正苦于以下问题:PHP SmrSession::account_id方法的具体用法?PHP SmrSession::account_id怎么用?PHP SmrSession::account_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmrSession
的用法示例。
在下文中一共展示了SmrSession::account_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: catch
try {
$account =& SmrAccount::createAccount($login, $password, $email, $first_name, $last_name, $address, $city, $postal_code, $country_code, $icq, $timez, $referral);
} catch (Exception $e) {
$msg = 'Invalid referral id!';
header('Location: ' . URL . '/error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES)));
exit;
}
$account->increaseSmrRewardCredits(2 * CREDITS_PER_DOLLAR);
// Give $2 worth of "reward" credits for joining.
if ($socialLogin) {
$account->addAuthMethod($_SESSION['socialLogin']->getLoginType(), $_SESSION['socialLogin']->getUserID());
$account->setValidated(true);
session_destroy();
}
// register session
SmrSession::$account_id = $account->getAccountID();
// save ip
$account->updateIP();
// send email with validation code to user
mail($email, 'New Space Merchant Realms User', 'Your validation code is: ' . $account->getValidationCode() . EOL . 'The Space Merchant Realms server is on the web at ' . URL . '/' . EOL . 'Please verify within the next 7 days or your account will be automatically deleted.', 'From: support@smrealms.de');
// remember when we sent validation code
$db->query('INSERT INTO notification (notification_type, account_id, time) ' . 'VALUES(\'validation_code\', ' . $db->escapeNumber(SmrSession::$account_id) . ', ' . $db->escapeNumber(TIME) . ')');
// insert into the account stats table
$db->query('INSERT INTO account_has_stats (account_id, HoF_name) VALUES(' . $db->escapeNumber(SmrSession::$account_id) . ', ' . $db->escape_string($account->getLogin()) . ')');
$container = create_container('login_processing2.php');
$container['login'] = $login;
$container['password'] = $password;
forwardURL($container);
} catch (Exception $e) {
handleException($e);
}
示例2: isset
exit;
}
}
} else {
$login = isset($_REQUEST['login']) ? $_REQUEST['login'] : (isset($var['login']) ? $var['login'] : '');
$password = isset($_REQUEST['password']) ? $_REQUEST['password'] : (isset($var['password']) ? $var['password'] : '');
// has the user submitted empty fields
if (empty($login) || empty($password)) {
$msg = 'Please enter login and password!';
header('Location: ' . URL . '/login.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES)));
exit;
}
$db->query('SELECT account_id,old_account_id FROM account ' . 'WHERE login = ' . $db->escapeString($login) . ' AND ' . 'password = ' . $db->escapeString(md5($password)) . ' LIMIT 1');
if ($db->nextRecord()) {
// register session
SmrSession::$account_id = $db->getField('account_id');
SmrSession::$old_account_id = $db->getField('old_account_id');
} else {
if (USE_COMPATIBILITY) {
if (!SmrAccount::upgradeAccount($login, $password)) {
$msg = 'Password is incorrect!';
header('Location: ' . URL . '/login.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES)));
exit;
}
} else {
$msg = 'Password is incorrect!';
header('Location: ' . URL . '/login.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES)));
exit;
}
}
}
示例3: changeNPCLogin
function changeNPCLogin()
{
global $NPC_LOGIN, $actions, $NPC_LOGINS_USED, $underAttack, $previousContainer;
if ($actions > 0) {
debug('We have taken actions and now want to change NPC, let\'s exit and let next script choose a new NPC to reset execution time', getrusage());
exitNPC();
}
$actions = -1;
$GLOBALS['TRADE_ROUTE'] = null;
$db = new SmrMySqlDatabase();
$db->query('UPDATE npc_logins SET working=' . $db->escapeBoolean(false) . ' WHERE login=' . $db->escapeString($NPC_LOGIN['Login']));
if ($db->getChangedRows() > 0) {
debug('Unlocked NPC: ' . $NPC_LOGIN['Login']);
} else {
debug('Failed to unlock NPC: ' . $NPC_LOGIN['Login']);
}
$NPC_LOGIN = null;
// We chose a new NPC, we don't care what we were doing beforehand.
$previousContainer = null;
debug('Choosing new NPC');
$db2 = new SmrMySqlDatabase();
$db->query('SELECT login, npc.player_name, alliance_name
FROM npc_logins npc
LEFT JOIN account a USING(login)
LEFT JOIN player p ON a.account_id = p.account_id AND p.game_id = ' . $db->escapeNumber(NPC_GAME_ID) . '
WHERE active=' . $db->escapeBoolean(true) . ' AND working=' . $db->escapeBoolean(false) . ' AND login NOT IN (' . $db->escapeArray($NPC_LOGINS_USED) . ')
ORDER BY (turns IS NOT NULL), turns DESC');
while ($db->nextRecord()) {
$db2->query('UPDATE npc_logins SET working=' . $db2->escapeBoolean(true) . ' WHERE login=' . $db2->escapeString($db->getField('login')) . ' AND working=' . $db2->escapeBoolean(false));
if ($db2->getChangedRows() > 0) {
$NPC_LOGIN = array('Login' => $db->getField('login'), 'PlayerName' => $db->getField('player_name'), 'AllianceName' => $db->getField('alliance_name'));
break;
}
}
$NPC_LOGINS_USED[] = $NPC_LOGIN['Login'];
if ($NPC_LOGIN === null) {
debug('No free NPCs');
exitNPC();
}
debug('Chosen NPC: ' . $NPC_LOGIN['Login']);
if (SmrAccount::getAccountByName($NPC_LOGIN['Login']) == null) {
debug('Creating account for: ' . $NPC_LOGIN['Login']);
$account =& SmrAccount::createAccount($NPC_LOGIN['Login'], '', 'NPC@smrealms.de', 'NPC', 'NPC', 'NPC', 'NPC', 'NPC', 'NPC', 'NPC', 0, 0);
$account->setValidated(true);
} else {
$account =& SmrAccount::getAccountByName($NPC_LOGIN['Login']);
}
$GLOBALS['account'] =& $account;
SmrSession::$account_id = $account->getAccountID();
$underAttack = false;
//Auto-create player if need be.
$db->query('SELECT 1 FROM player WHERE account_id = ' . $account->getAccountID() . ' AND game_id = ' . NPC_GAME_ID . ' LIMIT 1');
if (!$db->nextRecord()) {
SmrSession::$game_id = 0;
//Have to be out of game to join game.
debug('Auto-creating player: ' . $account->getLogin());
processContainer(joinGame(SmrSession::$game_id, $NPC_LOGIN['PlayerName']));
}
throw new Exception('Forward');
}