Location: PHPKode > projects > Merchant Empires > merchempires/merchantempires/starbase_exit.php
<?php
/****************************************************************************
*    Copyright (C) 2000 Bryan Brunton
*
*    This program is free software; you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation; either version 2 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with this program; if not, write to the Free Software
*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
****************************************************************************/

page_open(array("sess" => "ME_Session_Uncached", "auth" => "ME_Auth"));
include("./merchantempiresdefines.php");
$sess->register("player_id");

include("./lib/ship.php");
include("./lib/player.php");
include("./lib/sector.php");
include("./lib/player_redirect.php");

if ( $player_id > 0 )  {
	$ship = new ME_Ship;
	$ship->get_ship($player_id);

	if ( $ship->f("starbase_id") > 0 ) {
		$db = new ME_DB;
		$query = sprintf("select * from starbases where starbase_id = '%s'", $ship->f("starbase_id"));
		$db->query($query);
		$db->next_record();
		
		if ( $db->f("starbase_id") > 0 ) {
			$ship->set_starbase_id(0);
			$ship->set_planet_id(0);
			$ship->set_sector_id($db->f("sector_id"));
			$ship->set_public_sector_id($db->f("public_sector_id"));
			$ship->save();
		}
	}
}

$newurl = $sess->url(URL . "local_map.php");
header("Location: $newurl");

page_close();
?>
Return current item: Merchant Empires