I seem to have something wrong with this script, it displays no errors, but it does absolutely nothing. It just stays on the page, whilist its blank. I got the server to enable errors and they have worked before, but it just does nothing, is it something to do with the amount of elseif's i have, or is it incorrectly formatted?
http://www.zanjo.byethost4.com/reg.php //Form that posts info
http://www.zanjo.byethost4.com/register.php //PHP script that processors
<?php session_start();
include("database.php");
$username = $_POST['Username'];
$password = sha1($_POST['Password']);
$confirm = sha1($_POST['Confirm']);
$firstname = $_POST['Firstname'];
$lastname = $_POST['Lastname'];
$email = $_POST['Email'];
$country = $_POST['Country'];
$conn = mysql_connect('localhost','******','******');
mysql_select_db($conn);
$sql = "SELECT * FROM login WHERE $username";
$query = "mysql_query($sql)";
$num = "mysql_num_rows($query)";
if ($username == null)
{
$_SESSION['uerror'] == 1;
$_SESSION['error'] == 1;
}
elseif (eregi("^[A-Z0-9-]$",$username) != '1' )
{
$_SESSION['uerror'] == 2;
$_SESSION['error'] == 1;
}
elseif ($num != 0)
{
$_SESSION['uerrer'] == 3;
$_SESSION['error'] == 1;
}
elseif ($password == null)
{
$_SESSION['perror'] == 1;
$_SESSION['error'] == 1;
}
elseif (eregi("^[A-Z0-9-]$", $password) != '1')
{
$_SESSION['perror'] == 2;
$_SESSION['error'] == 1;
}
elseif ($password != $confirm)
{
$_SESSION['pcerror'] == 1;
$_SESSION['error'] == 1;
}
elseif (eregi("^[A-Z0-9-]$", $confirm) != '1')
{
$_SESSION['cerror'] == 2;
$_SESSION['error'] == 1;
}
elseif ($confirm == null)
{
$_SESSION['cerror'] == 1;
$_SESSION['error'] == 1;
}
elseif ($firstname == null)
{
$_SESSION['fnerror'] == 1;
$_SESSION['error'] == 1;
}
elseif (eregi("^[A-Z]$", $firstname) != 1)
{
$_SESSION['fnerror'] ==2;
$_SESSION['error'] == 1;
}
elseif ($lastname == null)
{
$_SESSION['lnerror'] == 1;
$_SESSION['error'] == 1;
}
elseif (eregi("^[A-Z-]$", $lastname) != 1)
{
$_SESSION['lnerror'] ==2;
$_SESSION['error'] == 1;
}
elseif ($email == null)
{
$_SESSION['eerror'] == 1;
$_SESSION['error'] == 1;
}
elseif (ereg("^.+@.+\..+$", $email))
{
$_SESSION['eerror'] == 2;
$_SESSION['error'] == 1;
}
elseif ($country == null)
{
$_SESSION['cerror'] == 1;
$_SESSION['error'] == 1;
}
elseif (ereg("^[A-Za-z-]$", $country))
{
$_SESSION['cerror'] == 2;
$_SESSION['error'] == 1;
}
elseif ($_SESSION['error'] == 1)
{
header("Location:reg.php");
exit();
}
else
{
$dateoc = 'date(D d M Y g:i:s a T)';
$_SESSION['access'] == 1;
$sql = "INSERT INTO login (`username`,`password`,`firstname`,`lastname`,
`email`,`country`,`dateofcreation`,`memberlevel`)
VALUES ('$username','$password','$firstname','$lastname','$email','$country',
'$dateoc','Member')";
mysql_query($sql);
header("Location:members.php");
}
?>