//Installationsroutine
if ((isset($_POST['action'])) AND ($_POST['action'] == "install")) {
$mysql_host = $_POST['mysql_host'];
$mysql_user = $_POST['mysql_user'];
$mysql_pass = $_POST['mysql_pass'];
$mysql_database = $_POST['mysql_database'];
$mysql_prefix = $_POST['mysql_prefix'];
$admin_name = $_POST['admin_name'];
$admin_pass = $_POST['admin_pass'];
$admin_volk = $_POST['admin_volk'];
//Verbinden mit MYSQL und Auswahl der Datenbank
@mysql_connect($mysql_host, $mysql_user, $mysql_pass) OR die(mysql_error());
mysql_select_db($mysql_database) OR die(mysql_error());
//Tabellen erstellen
$sql="CREATE TABLE `".$mysql_prefix."spieler` (
`sid` int(11) auto_increment,
`name` varchar(20),
`pass` varchar(32),
`rechte` varchar(50),
`volk` char(3),
`aktiv` smallint(1) default '0',
`start` datetime default '0000-00-00',
`lastlogin` datetime default '0000-00-00',
`lastchange` date default '0000-00-00',
PRIMARY KEY (`sid`)
)";
mysql_query($sql);
$sql="CREATE TABLE `".$mysql_prefix."stat` (
`ID` int(11) auto_increment,
`sid` int(11),
`truppen` int(11),
`datum` date default '0000-00-00',
PRIMARY KEY (`ID`)
)";
mysql_query($sql);
$sql="CREATE TABLE `".$mysql_prefix."truppen` (
`tid` int(11) auto_increment,
`sid` int(11) default '0',
`x1` smallint(4),
`y1` smallint(4),
`herkunft` varchar(20),
`x2` smallint(4),
`y2` smallint(4),
`standort` varchar(20),
`volk` char(3),
`datum` date default '0000-00-00',
`t1` int(11) default '0',
`t2` int(11) default '0',
`t3` int(11) default '0',
`t4` int(11) default '0',
`t5` int(11) default '0',
`t6` int(11) default '0',
`t7` int(11) default '0',
`t8` int(11) default '0',
`t9` int(11) default '0',
`t10` int(11) default '0',
PRIMARY KEY (`tid`)
)";
mysql_query($sql);
$sql="INSERT INTO ".$mysql_prefix."spieler
(name, pass, rechte, volk, aktiv, start)
VALUES
('".$admin_name."', '".md5($admin_pass)."', '2|3|2|2', '".$admin_volk."', '1', NOW())";
mysql_query($sql);
//Konfiguration schreiben
$datei = fopen("inc_config.php","w");
$temp = "";
fwrite($datei, $temp);
$temp = "define('MYSQL_HOST','".$mysql_host."');";
fwrite($datei, $temp);
$temp = "define('MYSQL_USER','".$mysql_user."');";
fwrite($datei, $temp);
$temp = "define('MYSQL_PASS','".$mysql_pass."');";
fwrite($datei, $temp);
$temp = "define('MYSQL_DATABASE','".$mysql_database."');";
fwrite($datei, $temp);
$temp = "define('PREFIX','".$mysql_prefix."');";
fwrite($datei, $temp);
$temp = "?>";
fwrite($datei, $temp);
fclose($datei);
echo "
Setup successfully completedforward";
} else {
?>
}
?>