} else {
		$error = 101;
	}
}

if ($do == 'changegalaxy') { 
	$password = secureData($_POST['password']);
	$sql_checkgal = "SELECT `id`, `x`, `y` FROM $table[galaxy] WHERE `private` = '1' AND `password` = '$password'";
	$res_checkgal = mysql_query($sql_checkgal);
	$num_checkgal = mysql_num_rows($res_checkgal);
	$rec_checkgal = mysql_fetch_array($res_checkgal);
	
	if ($num_checkgal > 0) {
		if (getFreeGalaxySpot($rec_checkgal['id'])) {
			$galaxy_spot = getFreeGalaxySpot($rec_checkgal['id']);
			if ($playerdata['id'] == getGalaxyCommander($playerdata['galaxy_id'])) {
				$sql_updgalcom = "UPDATE $table[galaxy] SET `commander_id` = '0', `moc_id` = '0', `mow_id` = '0', `moe_id` = '0' WHERE `id` = '$playerdata[galaxy_id]'";
			}
			if ($field = isPlayerMinister($playerdata['id'])) {
				$sql_updgalcom = "UPDATE $table[galaxy] SET `$field` = '0' WHERE `id` = '$playerdata[galaxy_id]'";
			}
			$playerdata['galaxy_id'] = $rec_checkgal['id'];
			$playerdata['galaxy_spot'] = $galaxy_spot;
			$playerdata['res_steel'] -= ($playerdata['res_steel'] * 0.3);
			$playerdata['res_crystal'] -= ($playerdata['res_crystal'] * 0.3);
			$playerdata['res_erbium'] -= ($playerdata['res_erbium'] * 0.3);
			$playerdata['res_titanium'] -= ($playerdata['res_titanium'] * 0.3);
			
			$sql_remvotes = "DELETE FROM $table[politics] WHERE `player_id` = '$playerdata[id]' OR `voted_on` = '$playerdata[id]'";
			mysql_query($sql_remvotes) or die(mysql_error());
			
	if ($error > 100) { $error_color = 'red'; }
	else { $error_color = 'green'; }
?>
<table border="0" cellpadding="0" cellspacing="0" width="800">
	<tr>
		<td valign="top"><p align="center"><font color="<?echo $error_color;?>"><?echo $msg;?></font></td>
	</tr>
	<tr height="15">
		<td valign="top"></td>
	</tr>	
</table>
<?
}
unset($error, $msg);
$moc_id = getMOC($playerdata['galaxy_id']);
$gc_id = getGalaxyCommander($playerdata['galaxy_id']);
?>

<table border="0" cellpadding="0" cellspacing="0" width="800">
	<tr>
		<td width="4" valign="bottom"><img border="0" src="img/border/L_B.gif" width="20" height="15"></td>
		<td width="180">Galaxy forum</td>
		<td width="612" background="img/border/B.gif"><img border="0" src="img/border/B.gif" width="16" height="15"></td>
		<td width="4" valign="bottom"><img border="0" src="img/border/R_B.gif" width="20" height="15"></td>
	</tr>
	<tr>
		<td width="4" background="img/border/L.gif">&nbsp;</td>
		<td width="696" height="100%" valign="top" colspan="2">
			<table border="0" cellpadding="0" cellspacing="0" width="800">
				<tr>
					<td valign="top">