Location: PHPKode > projects > Babylon 5: Upheaval > b5-upheaval/register.php
<!--    

	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/>.

 -->

<html>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<link rel="stylesheet" type="text/css" href="format.css">

<ul id="Navigation">
Navigation
	<a href="register.php">Anmelden</a>
	<a href="login.php">Login</a>
</ul>


<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
  <font face="Courier">
    Name: <input type="text" name="name"><br/>
    Pwd : <input type="text" name="pass"><br/>
    Spez: <input type="text" name="rasse"><br/><br/>
  <input type="submit" />
  </font>
</form>


<?php

	error_reporting(E_ALL);
	@session_start();

	include_once('db_include.inc');	

	mysql_connect(HOST,USER,PASS)or die(mysql_error());
	mysql_select_db(DATABASE) or die(mysql_error());

	if (!empty($_POST["name"]) && !empty($_POST["pass"])&& !empty($_POST["rasse"]))
	{
		$name     = $_POST["name"];
		$passwort = $_POST["pass"]; 
		$rasse    = $_POST["rasse"];
		
		$planet_name = "planeten"."_".$name;

		$names_check    = "SELECT id FROM users WHERE name='$name'";
		$names_eintrag  = "INSERT INTO users VALUES   ('','$name','$passwort','$rasse')";
		$planet_eintrag = "CREATE TABLE $planet_name (`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
																	  `x`  TINYINT NOT NULL ,
																	  `y`  TINYINT NOT NULL ,
																	  `credits` INT  NOT NULL ,
																	  `economy` INT  NOT NULL ,
																	  `population` INT  NOT NULL ,
																	  `bio` INT  NOT NULL ,
 																	  `mineral` INT  NOT NULL ,
																	  `gas` INT  NOT NULL ,
																	  `energy` INT  NOT NULL ,
																	  `moral` INT  NOT NULL ,
																	  `research` INT  NOT NULL ,
																	  `name` TEXT  NOT NULL ,
																	  `besitzer` TEXT NOT NULL,
																	  `gas_1_count` INT NOT NULL DEFAULT '1',
																	  `gas_1_flag` BOOL NOT NULL DEFAULT '1',
																	  `gas_1_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `mineral_1_count` TINYINT NOT NULL DEFAULT '1',
																	  `mineral_1_flag` BOOL NOT NULL DEFAULT '1',
																	  `mineral_1_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `bio_1_count` TINYINT NOT NULL DEFAULT '0',
																	  `bio_1_flag` BOOL NOT NULL DEFAULT '0',
																	  `bio_1_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `energy_1_count` TINYINT NOT NULL DEFAULT '1',
																	  `energy_1_flag` BOOL NOT NULL DEFAULT '1',
																	  `energy_1_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `research_1_count` TINYINT NOT NULL DEFAULT '0',
																	  `research_1_flag` BOOL NOT NULL DEFAULT '1',
																	  `research_1_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `gas_2_count` INT NOT NULL DEFAULT '0',
																	  `gas_2_flag` BOOL NOT NULL DEFAULT '0',
																	  `gas_2_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `mineral_2_count` TINYINT NOT NULL DEFAULT '0',
																	  `mineral_2_flag` BOOL NOT NULL DEFAULT '0',
																	  `mineral_2_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `bio_2_count` TINYINT NOT NULL DEFAULT '0',
																	  `bio_2_flag` BOOL NOT NULL DEFAULT '0',
																	  `bio_2_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `energy_2_count` TINYINT NOT NULL DEFAULT '0',
																	  `energy_2_flag` BOOL NOT NULL DEFAULT '0',
																	  `energy_2_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `research_2_count` TINYINT NOT NULL DEFAULT '0',
																	  `research_2_flag` BOOL NOT NULL DEFAULT '0',
																	  `research_2_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `gas_3_count` INT NOT NULL DEFAULT '0',
																	  `gas_3_flag` BOOL NOT NULL DEFAULT '0',
																	  `gas_3_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `mineral_3_count` TINYINT NOT NULL DEFAULT '0',
																	  `mineral_3_flag` BOOL NOT NULL DEFAULT '0',
																	  `mineral_3_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `bio_3_count` TINYINT NOT NULL DEFAULT '0',
																	  `bio_3_flag` BOOL NOT NULL DEFAULT '0',
																	  `bio_3_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `energy_3_count` TINYINT NOT NULL DEFAULT '0',
																	  `energy_3_flag` BOOL NOT NULL DEFAULT '0',
																	  `energy_3_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `research_3_count` TINYINT NOT NULL DEFAULT '0',
																	  `research_3_flag` BOOL NOT NULL DEFAULT '0',
																	  `research_3_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `gas_4_count` INT NOT NULL DEFAULT '0',
																	  `gas_4_flag` BOOL NOT NULL DEFAULT '0',
																	  `gas_4_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `mineral_4_count` TINYINT NOT NULL DEFAULT '0',
																	  `mineral_4_flag` BOOL NOT NULL DEFAULT '0',
																	  `mineral_4_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `bio_4_count` TINYINT NOT NULL DEFAULT '0',
																	  `bio_4_flag` BOOL NOT NULL DEFAULT '0',
																	  `bio_4_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `energy_4_count` TINYINT NOT NULL DEFAULT '0',
																	  `energy_4_flag` BOOL NOT NULL DEFAULT '0',
																	  `energy_4_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `research_4_count` TINYINT NOT NULL DEFAULT '0',
																	  `research_4_flag` BOOL NOT NULL DEFAULT '0',
																	  `research_4_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `gas_5_count` INT NOT NULL DEFAULT '0',
																	  `gas_5_flag` BOOL NOT NULL DEFAULT '0',
																	  `gas_5_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `mineral_5_count` TINYINT NOT NULL DEFAULT '0',
																	  `mineral_5_flag` BOOL NOT NULL DEFAULT '0',
																	  `mineral_5_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `bio_5_count` TINYINT NOT NULL DEFAULT '0',
																	  `bio_5_flag` BOOL NOT NULL DEFAULT '0',
																	  `bio_5_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `energy_5_count` TINYINT NOT NULL DEFAULT '0',
																	  `energy_5_flag` BOOL NOT NULL DEFAULT '0',
																	  `energy_5_pro` BIGINT NOT NULL DEFAULT '-1',
																	  `research_5_count` TINYINT NOT NULL DEFAULT '0',
																	  `research_5_flag` BOOL NOT NULL DEFAULT '0',
																	  `research_5_pro` BIGINT NOT NULL DEFAULT '-1'
															  		 ) ENGINE = MYISAM ;"; 
															  
		$rows = mysql_num_rows(mysql_query($names_check)).mysql_error();
		if ($rows == 0)
		{
			mysql_query($planet_eintrag).mysql_error();
			mysql_query($names_eintrag).mysql_error();
			echo "Sie wurden erfolgreich registriert.";
			$_SESSION['name'] = $name;
			include("php_functions/add_planet.php");
		}
		else
		{
			echo "Spielername bereits vergeben...";
		}

	}	
	  
?>

</html>
Return current item: Babylon 5: Upheaval