<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" href="popstyle.css" type="text/css" media="screen" /></head>
<body class="oneColElsCtr">
<div id="container">
<div id="mainContent">
<?php
require('config.php');
if(!$_POST['register']){
echo "<form method=\"POST\">";
echo "<center><table border=\"0\" width=\"200\">";
echo "<tr><td align=\"right\" width=\"50%\"><b>Username</b></td><td><input type=\"text\"
name=\"username\" maxlength=\"12\"></td></tr>";
echo "<tr><td align=\"right\" width=\"50%\"><b>Password</b></td><td><input type=\"password\"
name=\"password\" maxlength=\"12\"></td></tr>";
echo "<tr><td align=\"right\" width=\"50%\"><b>Confirm Password</b></td><td><input type=\"password\"
name=\"cpassword\" maxlength=\"12\"></td></tr>";
echo "<tr><td align=\"right\" width=\"50%\"><b>E-Mail</b></td><td><input type=\"text\"
name=\"email\"></td></tr>";
echo "<tr><td align=\"right\" width=\"50%\"><b>Birthday</b><br /><i>(YYYY-MM-DD)</i></td><td
valign=\"top\"><input type=\"text\" maxlength=\"10\" name=\"birth\"></td></tr>";
echo "<tr><td></td><td><input type=\"submit\" value=\"Register\" name=\"register\">";
echo "</table></center></form>";
}else{
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
$cpassword = mysql_real_escape_string($_POST['cpassword']);
$email = mysql_real_escape_string($_POST['email']);
$birth = mysql_real_escape_string($_POST['birth']);
$ucheck = mysql_query("SELECT * FROM `accounts` WHERE `name`='".$username."'") or die(mysql_error());
if($username == ""){
echo "Please supply an username!";
}elseif(mysql_num_rows($ucheck) >= 1){
echo "The username already exists. Please select another one!";
}elseif($password == ""){
echo "Please supply a password!";
}elseif($password != $cpassword){
echo "The passwords don't match!";
}elseif($email == ""){
echo "Please supply an e-mail!";
}elseif(strlen($username) < 4){
echo "Username must be between 4 and 12 characters!";
}elseif(strlen($username) > 12){
echo "Username must be between 4 and 12 characters!";
}elseif(strlen($password) < 6){
echo "Password must be between 6 and 12 characters!";
}elseif(strlen($password) > 12){
echo "Password must be between 6 and 12 characters!";
}elseif($birth == ""){
echo "Please supply a birth date!";
}else{
$ia = mysql_query("INSERT INTO `accounts` (`name`,`password`,`birthday`,`email`) VALUES
('".$username."','".sha1($password)."','".$birth."','".$email."')") or die(mysql_error());
echo "The user has been succesfully added into the database! You can now log into the community
and in-game!<br /><br />";
echo "blahblah<br />";
echo "BLAHBLAH";
}
}
?>
</p>
<!-- end #mainContent --></div>
<!-- end #container --><img src="img/copyrightsm.gif" /></div>
</body>
</html>