function do_voodoo() { ob_clean(); global $lock, $var; foreach ($GLOBALS as $key => $value) { ${$key} =& $GLOBALS[$key]; } // initialize objects we usually need, like player, ship if (SmrSession::$game_id > 0) { $db = new SmrMySqlDatabase(); // We need to acquire locks BEFORE getting the player information // Otherwise we could be working on stale information $db->query('SELECT sector_id FROM player WHERE account_id=' . SmrSession::$old_account_id . ' AND game_id=' . SmrSession::$game_id . ' LIMIT 1'); $db->next_record(); $sector_id = $db->f('sector_id'); if (!$lock && $var['body'] != 'error.php' && !isset($var['ForwardError'])) { if (!acquire_lock($sector_id)) { create_error("Failed to acquire sector lock"); } } // Now that they've acquire a lock we can move on $player = new SMR_PLAYER(SmrSession::$old_account_id, SmrSession::$game_id); if ($player->dead == 'TRUE' && $var['body'] != 'death.php' && !isset($var['override_death'])) { $container = array(); $container["url"] = "skeleton.php"; $container["body"] = "death.php"; forward($container); } $ship = new SMR_SHIP(SmrSession::$old_account_id, SmrSession::$game_id); // update turns on that player $player->update_turns($ship->speed); if ($player->newbie_turns <= 20 && $player->newbie_warning == "TRUE" && $var["body"] != "newbie_warning.php") { forward(create_container("skeleton.php", "newbie_warning.php")); } } require get_file_loc($var["url"]); SmrSession::update(); if ($lock) { release_lock($lock); } exit; }
$container["url"] = "skeleton.php"; if ($player->land_on_planet == "TRUE") { $container["body"] = "planet_main.php"; } else { $container["body"] = "current_sector.php"; } require_once get_file_loc('smr_alliance.inc'); require_once get_file_loc("smr_force.inc"); require_once get_file_loc("smr_planet.inc"); require_once get_file_loc("smr_port.inc"); require_once get_file_loc('smr_sector.inc'); $player = new SMR_PLAYER(SmrSession::$old_account_id, SmrSession::$game_id); $ship = new SMR_SHIP(SmrSession::$old_account_id, SmrSession::$game_id); $sector = new SMR_SECTOR($player->sector_id, SmrSession::$game_id, SmrSession::$old_account_id); // update turns on that player $player->update_turns($ship->speed); // we cant move if we are dead //check if we are in kill db...if we are we don't do anything $db->query("SELECT * FROM kills WHERE dead_id = {$player->account_id} AND game_id = {$player->game_id}"); if (!$db->next_record()) { if ($ship->hardware[HARDWARE_SHIELDS] == 0 && $ship->hardware[HARDWARE_ARMOR] == 0 && ($var["body"] != "trader_attack.php" && $var["url"] != "trader_attack_processing.php" && $var["body"] != "port_attack.php" && $var["url"] != "port_attack_processing.php" && $var["body"] != "planet_attack.php" && $var["url"] != "planet_attack_processing.php")) { $player->sector_id = $player->get_home(); $player->newbie_turns = 100; $player->mark_dead(); $player->update(); $ship->get_pod(); //print("$var[body], $var[url]"); $container = array(); $container["url"] = "skeleton.php"; $container["body"] = "current_sector.php"; forward($container);
$index = $databaseClassName . $game_id; $games['Play'][$index]['ID'] = $game_id; $games['Play'][$index]['Name'] = $db->getField('game_name'); $games['Play'][$index]['Type'] = $db->getField('game_type'); $games['Play'][$index]['EndDate'] = $db->getField('end_date'); $games['Play'][$index]['Speed'] = $db->getField('game_speed'); $games['Play'][$index]['Type'] = $db->getField('game_type'); $container = array(); $container['game_id'] = $game_id; $container['url'] = 'game_play_processing.php'; $games['Play'][$index]['PlayGameLink'] = 'loader2.php?sn=' . SmrSession::addLink($container); // creates a new player object $curr_player = new SMR_PLAYER(SmrSession::$old_account_id, $game_id); $curr_ship = new SMR_SHIP(SmrSession::$old_account_id, $game_id); // update turns for this game $curr_player->update_turns($curr_ship->speed); // generate list of game_id that this player is joined $game_id_list[] = $game_id; $db2 = new $databaseClassName(); $db2->query('SELECT count(*) as num_playing FROM player WHERE last_active >= ' . $db->escapeNumber(TIME - 600) . ' AND game_id = ' . $db->escapeNumber($game_id)); $db2->nextRecord(); $games['Play'][$index]['NumberPlaying'] = $db2->getField('num_playing'); // create a container that will hold next url and additional variables. $container_game = array(); $container_game['url'] = 'skeleton.php'; $container_game['body'] = 'game_stats.php'; $container_game['game_id'] = $game_id; $games['Play'][$index]['GameStatsLink'] = SmrSession::getNewHREF($container_game); $games['Play'][$index]['Maintenance'] = $curr_player->turns;