";
}
else
{
$u=strtolower(addslashes($_POST['username']));
$p=strtolower(addslashes($_POST['password']));
$p2=strtolower(addslashes($_POST['password2']));
if(validname($u)=="false" || validname($p)=="false" || validname($p2)=="false")
{
$message.="Invalid entries. 3-12 characters, Alpha-Numeric only.
";
}
else
{
if($p!=$p2)
{
$message.="Passwords didn't match.
";
}
else
{
$result = mysql_query("SELECT * FROM mrpg_users WHERE name='$u'");
while($row = mysql_fetch_array($result))
{
$namecheck=$row['id'];
}
if($namecheck!="")
{
$message.="Username is taken!.
";
}
else
{
//Register
$id=0;
$result = mysql_query("SELECT id FROM mrpg_users");
while($row = mysql_fetch_array($result))
{
if(($row['id']+1)>$id)
{
$id=($row['id']+1);
}
}
mysql_query("INSERT INTO `mrpg_users` ( `id` , `name` , `password` , `x` , `y` , `dir` , `inventory` , `level` , `lastact` , `mode` )
VALUES (
'$id', '$u', '$p', '5', '3', '0', '', '0', '0', 'norm'
);");
mysql_query("INSERT INTO `mrpg_confirm` VALUES (
'$id', '', '0', '0', '0', '0'
);");
mysql_query("INSERT INTO `mrpg_message` VALUES (
'$id', '', '0', '0'
);");
mysql_query("INSERT INTO `mrpg_battles` ( `id` , `use` , `enemy` , `enemyhp` , `other` )
VALUES (
'$id', '0', '0', '0', ''
);");
mysql_query("INSERT INTO `mrpg_stat` ( `id` , `hp` , `maxhp` , `pp` , `offense` , `defense` , `fight` , `speed` , `wisdom` , `strength` , `force` , `poison` , `other` )
VALUES (
'$id', '20', '20', '5', '1', '1', '1', '1', '1', '1', '1', '0', '0'
);");
$message.="Registered! You can now play!";
}
}
}
}
}
?>