<!--
Copyright 2007 Martin Remisch
This file is part of "Babylon 5: Upheaval".
"Babylon 5: Upheaval" 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 3 of the License, or
(at your option) any later version.
"Babylon 5: Upheaval" 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 "Babylon 5: Upheaval". If not, see <http://www.gnu.org/licenses/>.
-->
<?php
@session_start();
error_reporting(E_ALL);
include_once('/var/www/localhost/htdocs/alpha/db_include.inc');
mysql_connect(@HOST,@USER,@PASS)or die(mysql_error());
mysql_select_db(@DATABASE) or die(mysql_error());
srand(microtime()*1000000);
$name = $_SESSION['name'];
$planet_name = "planeten_".$_SESSION['name'];
$einstiegspunkt = rand(1,625);
$wahl = 0;
while($wahl == 0)
{
$freier_planet = "SELECT x,y,besitzer,typ FROM universum WHERE besitzer='keiner' AND id='$einstiegspunkt'";
$query = mysql_query($freier_planet);
$ergebnis = mysql_num_rows($query);
if ($ergebnis == 1)
{
$insertion = mysql_fetch_array($query);
$planet_eintrag = "INSERT INTO $planet_name (x, y, credits, economy, population, bio, mineral, gas, energy, moral, research, name, besitzer)
VALUES ('$insertion[0]','$insertion[1]','5000','10','10','5','80','35','10','100','0','Kolonie','$name')";
$universum_eintrag = "UPDATE universum SET besitzer = '".$name."' WHERE x='".$insertion[0]."' AND y='".$insertion[1]."'";
mysql_query($universum_eintrag);
mysql_query($planet_eintrag);
$wahl = 1;
}
else
{
if ($einstiegspunkt == 625)
{
$einstiegspunkt = 1;
}
else
{
$einstiegspunkt++;
}
}
}
?>