' . mysql_error();
}
}
function check()
{
mysql_select_db("divnxn5_web");
$result = mysql_query("SELECT `username` FROM `users` WHERE `username` = '$username'");
$error = mysql_query($result) OR die(mysql_error());
while($row = mysql_fetch_array($result))
{
echo "The username " . $username . 'is already taken!';
}
}
if(!$con)
{
echo "
Registering is disabled right now, please check back later.";
}
else
{
if(!$_POST['register'])
{
echo "
Use the following form to register a new account with us.
";
}
else
{
if(!$username)
echo "The username you entered encountered a problem.
";
check();
if(!$password || !$password2)
echo "The password field cannot be left empty!
";
if(!$email)
echo "The email you entered encountered a problem.
";
if(!$password == $password2)
echo "The passwords you entered do not match.
";
else
{
mysql_select_db("divnxn5_web");
mysql_query("INSERT INTO users(username, password, email) VALUES('{$username}', '{$password}', '{$email}')");
error();
mysql_close($con);
echo "Thank you for registering with us " . $username . '! Enjoy your stay!';
}
}
}
?>