Then can you tell me why this doesn't work? 🙁 I get a parse error at the line after the last else statement.
$user=$_POST['user'];
$pass=$_POST['pass'];
$email=$_POST['email'];
$confirm_pass=$_POST['pass2'];
if ($_POST['pass2']==$_POST['pass']);
{
if ($user && $email && $pass)
{
if (valid ($email))
{
$result = mysql_query("SELECT * FROM users WHERE name = '".$user."'");
if (mysql_num_rows ($result) == 0)
{
$result = mysql_query ("INSERT INTO users (name, password, email, mod, showemail) VALUES ('.$user.', PASSWORD('.$pass.'), '.$email.', '0', '1')");
if ($result)
{
$logged_in_user = $user;
session_register ("logged_in_user");
$result = mysql_query ("SELECT userID FROM users WHERE name = '".$user."'");
if (!$result)
{
fail ("select query failed on register page", true);
}
$record = mysql_fetch_assoc($result);
$logged_userID = $record["userID"];
session_register("logged_userID");
header("Registration", "Registration Complete");
echo "Your details have been added to the database, ".$logged_in_user.".<BR><BR> <A HREF='main.php'>Click here to proceed to the Forum.</A><BR><BR> <A HREF='enter.php'>Click here to log out.</A>";
exit;
}
else
{
fail("database query failed, registration page", true);
}
}
else
{
header("Registration", "Invalid registration");
echo "Sorry, that username has been taken. Please try another.<BR>";
}
}
else
{
header("Registration", "Invalid registration");
echo "Please submit a valid email address.";
}
}
// if less than all three fields have been filled up ..
else if ($user || $pass || $email)
{
header("Registration", "Invalid registration");
echo "Please fill in all fields.";
}
else
{
header("Registration", "Invalid registration");
echo "Please submit two identical passwords.";
}
}
else
{
header("Registration", "Registration");
}