<?php
error_reporting(0);
include("global.php");
if(isset($_POST['register']))
{
$time = time();
$realip = getRealIpAddr();
$realname = mysql_real_escape_string($_POST['first']." ".$_POST['second']);
$username = mysql_real_escape_string(ucfirst($_POST['first'])."-".ucfirst($_POST['second']));
$email = mysql_real_escape_string($_POST['email']);
$password = mysql_real_escape_string($_POST['password']);
$password_retype = mysql_real_escape_string($_POST['password_retype']);
if(!isset($_POST['first']) || $_POST['first'] == "" || !isset($_POST['second']) || $_POST['second'] == "" || !isset($_POST['email']) || $_POST['email'] == "" || !isset($_POST['password']) || $_POST['password'] == "" || !isset($_POST['password_retype']) || $_POST['password_retype'] == "")
{
$err = "You must fill in all the required fields..";
}
else if($password !== $password_retype)
{
$err = "The 2 passwords you entered dont match each other";
}
else if(NameIsTaken($username))
{
$err = "Someone has already registered with that name";
}
else if(!check_email_address($email))
{
$err = "The email you entered is invalid";
}
else
{
$pass = md5($password);
mysql_query("INSERT INTO `characters` (`id`, `account_uid`, `username`, `password`, `real_name`, `motto`, `figure`, `gender`, `credits_balance`, `activity_points_balance`, `activity_points_last_update`, `bank`, `score`, `privacy_accept_friends`, `home_room`, `auth_ticket`, `last_ip`, `config_volume`, `timestamp_lastvisit`, `timestamp_created`, `moderation_tickets`, `moderation_tickets_abusive`, `moderation_tickets_cooldown`, `moderation_bans`, `moderation_cautions`, `moderation_muted_until_timestamp`, `respect_points`, `respect_credit_humans`, `respect_credit_pets`, `health`, `str`, `xp`, `groupid`, `dead`, `jailed`, `working`, `otherfig`, `timer`, `jobrank`, `lastroom`) VALUES (NULL, '0', '$username', '$pass', '$realname', '', 'hr-165-34.sh-290-92.ch-215-84.hd-180-1.lg-280-64', 'M', '100', '2000', '0', '0', '0', '1', '1', '', '$realip', '100', '$time', '$time', '0', '0', '0', '0', '0', '', '0', '3', '3', '100', '1', '0', '2', '0', '0', '0', '', '0', '1', '1');");
?>
<script type="text/javascript">$(document).ready(function(){ window.location="<?php echo PATH; ?>" } )</script>
<?php
$err = "Please login :)";
}
}
if(isset($err)) { ?>
<script type="text/javascript">$(document).ready(function(){ DropDownAlert("<?php echo $err; ?>") } )</script>
<?php }
?>
<div class="header">
Register
</div>
<div class="content no_margin">
<form class="form" action="register.php" name="register" method="post">
First Name:<br />
<br />
<input class="input_default" type="text" name="first" value="<?php echo $_POST['first']; ?>" /><br />
<br />
Second Name:<br />
<br />
<input class="input_default" type="text" name="second" value="<?php echo $_POST['second']; ?>" /><br />
<br />
Email:<br />
<br />
<input class="input_default" type="text" name="email" value="<?php echo $_POST['email']; ?>" /><br />
<br />
Password:<br />
<br />
<input class="input_default" type="password" name="password" value="<?php echo $_POST['password']; ?>" /><br />
<br />
Retype Password:<br />
<br />
<input class="input_default" type="password" name="password_retype" value="<?php echo $_POST['password_retype']; ?>" /><br />
<br />
<input class="input_default_submit" type="submit" name="register" value="Register" />
</form>
<hr />
<a class="popup" href="login.php">Already have an account? Login!</a>
</div>