die();
}

bigtitle();

//if(isset($HTTP_POST_VARS["TPCreds"]))
//  collect_credits($HTTP_POST_VARS["TPCreds"]);
//else
if(isset($buildp) AND isset($builds)) {
	go_build_base($buildp, $builds);
	echo "<BR>";
	echo "Click <A HREF=planet-report.php>here</A> to return to report menu<br>";
} elseif(isset($my_ore_price)) {
	set_prices();
} else {
	change_planet_production($HTTP_POST_VARS);
	echo "<BR>";
	echo "Click <A HREF=planet-report.php>here</A> to return to report menu<br>";
}

echo "<BR><BR>";
TEXT_GOTOMAIN();

function set_prices() {
	// Set my global pricing for my planet selling
    global $db, $dbtables, $username;
  	global $ore_price, $ore_delta, $organics_price, $organics_delta, $goods_price, $goods_delta, $energy_price, $energy_delta;
	global $my_ore_price, $my_organics_price, $my_goods_price, $my_energy_price;
  	// Calculate maximum prices allowed
  	$max_ore_price = $ore_price-$ore_delta;
  	$max_organics_price = $organics_price-$organics_delta;
}
// This is required by Setup Info
// planet_hack_fix,0.2.0,25-02-2004,TheMightyDude
?>
<div class="tablecell content both-border">
	<div class="pad">
<?php 
bigtitle();
echo "<br>";
echo "Click <a href=planet_report.php>here</A> to return to report menu<br>";
if (isset($_POST["TPCreds"])) {
    collect_credits($_POST["TPCreds"]);
} elseif (isset($buildp) and isset($builds)) {
    go_build_base($buildp, $builds);
} else {
    change_planet_production($_POST);
}
echo "<br><br>";
TEXT_GOTOMAIN();
function go_build_base($planet_id, $sector_id)
{
    global $db;
    global $db_logging;
    global $base_ore, $base_organics, $base_goods, $base_credits;
    global $l_planet_bbuild;
    global $username;
    echo "<br>Click <a href=planet_report.php?PRepType=1>here</A> to return to the Planet Status Report<br><br>";
    $result = $db->Execute("SELECT * FROM {$db->prefix}ships WHERE ship_id='{$user_ship_id}'");
    db_op_result($db, $result, __LINE__, __FILE__, $db_logging);
    $playerinfo = $result->fields;
    $result2 = $db->Execute("SELECT * FROM {$db->prefix}universe WHERE sector_id={$playerinfo['sector']}");