registrieren.php

Ga naar de documentatie van deze file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2007 by Damian Bodde and Peter Wessels                  *
00004  *   damian@elsw.de  peter1wessels@gmail.com                               *
00005  *                                                                         *
00006  *   This program is free software; you can redistribute it and/or modify  *
00007  *   it under the terms of the GNU General Public License as published by  *
00008  *   the Free Software Foundation; either version 2 of the License, or     *
00009  *   (at your option) any later version.                                   *
00010  *                                                                         *
00011  *   This program is distributed in the hope that it will be useful,       *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU General Public License for more details.                          *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU General Public License     *
00017  *   along with this program; if not, write to the                         *
00018  *   Free Software Foundation, Inc.,                                       *
00019  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00020  ***************************************************************************/
00021 ?>
00022 
00023 <?php
00024 
00025 if(isset($_GET['action']))
00026 {
00027                 $action = $_GET['action'];
00028 }
00029 else
00030 {
00031                 $action = "main";
00032 }
00033 
00034 if($action == "main")
00035 {
00036                 if($_POST['send'] == True)
00037                 {
00038                                 $username = strip_tags(mysql_real_escape_string($_POST['username']));
00039                                 $passwort = strip_tags(mysql_real_escape_string($_POST['pass1']));
00040                                 $pass     = $_POST['pass2'];
00041                                 $email    = strip_tags(mysql_real_escape_string($_POST['email']));
00042                 
00043                                 if(!$username || !$passwort || !$pass || !$email)
00044                                 {
00045                                                 $meldung.= "Je wordt verzoekt om alles in te vullen";
00046                                 }
00047                                 
00048                                 if($passwort != $pass)
00049                                 {
00050                                                 $meldung.= "Sorry, je hebt niet 2 dezelfde wachtwoorden ingevuld.";
00051                                 }
00052                                 
00053                                 if(!$meldung)
00054                                 {
00055                                                 // Pr�fen ob user schon excistiert
00056                                                 $sql = ("SELECT name,email FROM users");
00057                                                 $result = mysql_query($sql);
00058                                                 while($row = mysql_fetch_array($result))
00059                                                 {
00060                                                                 if(strtolower($username) == strtolower($row['name']))
00061                                                                 {
00062                                                                                 $meldung.= "Je gebruikersnaam is al in gebruik kies een andere.";
00063                                                                 }
00064                                                                 
00065                                                                 if(strtolower($email) == strtolower($row['email']))
00066                                                                 {
00067                                                                                 $meldung.= regi_email_use;
00068                                                                 }
00069                                                 }
00070                                                 if(!$meldung)
00071                                                 {
00072                                                                 // Pr�fen ob email adresse g�ltig sein kann
00073                                                                  if(!eregi("^([a-z0-9_]|\-|\.)+@(([a-z0-9_]|\-)+\.)+[a-z]{2,4}\$",$email))
00074                                                                 {
00075                                                                                 $meldung.= "Je dient wel een bestaand e-mail adres in te vullen. Bijvoorbeeld: mijnnaam@mijnprovider.nl.";
00076                                                                 }
00077                                                                 
00078                                                                 if(!$meldung)
00079                                                                 {
00080                                                                                 // So zu aller letzt eintragen in die DB
00081                                                                                 $passwort = md5($passwort);
00082                                                                                 $sql = ("INSERT INTO users (name, email, pass,level) VALUES ('$username','$email','$passwort','3')");
00083                                                                                 mysql_query($sql) or die(mysql_error());
00084                                                                                 echo "Je bent succesvol geregistreert. Wij, de crew, wensen je veel plezier in het spel";
00085                                                                                 exit();
00086                                                                 }
00087                                                 }
00088                                 }
00089                 }
00090                 ?>
00091                 <form action=index.php?menu=registrieren&action=main method=post>
00092                                 <?=$meldung;?>
00093                                 <table>
00094                                                 <tr>
00095                                                                 <td>Gebruikersnaam:</td>
00096                                                                 <td>:</td>
00097                                                                 <td><input type=text class=input name=username></td>
00098                                                 </tr><tr>
00099                                                                 <td>Email</td>
00100                                                                 <td>:</td>
00101                                                                 <td><input type=text class=input name=email></td>
00102                                                 </tr><tr>
00103                                                                 <td>Wachtwoord:</td>
00104                                                                 <td>:</td>
00105                                                                 <td><input type=password class=input name=pass1></td>
00106                                                 </tr><tr>
00107                                                                 <td>Wachtwoord herhalen:</td>
00108                                                                 <td>:</td>
00109                                                                 <td><input type=password class=input name=pass2></td>
00110                                                 </tr>
00111                                 </table>
00112                                 <input type=submit name=send value=Registreren>
00113                 </form>
00114                 <?php
00115 }
00116 ?>

Gegenereerd op Wed May 30 17:41:06 2007 voor criminalcity.kdevelop door  doxygen 1.4.7