$msg = 'Password is missing!'; header('Location: ' . URL . '/error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES))); exit; } $pass_verify = $_REQUEST['pass_verify']; if ($password != $pass_verify) { $msg = 'The passwords you entered do not match.'; header('Location: ' . URL . '/error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES))); exit; } // get this user from db $login = $_REQUEST['login']; if ($login == $password) { $msg = 'Your chosen password is invalid!'; header('Location: ' . URL . '/error.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES))); exit; } // creates a new user account object $account =& SmrAccount::getAccountByName($login); $old_password = $_REQUEST['old_password']; //$passwordReset = $_REQUEST['password_reset']; if ($account == null || $account->checkPassword($old_password)) { // unknown user header('Location: ' . URL . '/error.php?msg=' . rawurlencode('User does not exist or your current password is wrong.')); exit; } $account->setPassword($password); header('Location: ' . URL . '/login.php'); } catch (Exception $e) { handleException($e); }
} elseif (in_array($match_sec, $next_arr)) { $stop = 'yes'; continue; } else { $next_arr[] = $match_sec; } } } elseif ($isset == 'yes' && !$db2->nextRecord()) { $PHP_OUTPUT .= 'Data Error 2: ' . $match_sec . ' does not exist!<br />'; $continue = '0'; } else { $continue = '0'; } } else { if (isset($match) && $match != '') { $curr_acc =& SmrAccount::getAccountByName($match); $id = $curr_acc->getAccountID(); } $db2->query('SELECT * FROM account_is_closed WHERE account_id = ' . $db->escapeNumber($id)); if ($db2->nextRecord()) { $match = $db2->getField('suspicion'); if (in_array($match, $names)) { $continue = 'next'; } else { $continue = 'TRUE'; $names[] = $match; if ($match != $login_name) { $PHP_OUTPUT .= $login_name . ' is disabled matching ' . $match . '<br />'; } } } else {
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='******'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='******'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', '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'); }