hey, ive got a simple registration script that doesnt seem to want to look, just some if else statements a few database connections thats, i cant seem to get this thing to work, its probally something simple, any help would be appreciated.
[code=php]
<?php
include(“database.inc”);
$username = $_POST[‘username’];
$password = $_POST[‘password’];
$v_password = $_POST[‘vpassword’];
$email = $_POST[’email’];
$v_email = $_POST[‘vemail’];
if ($username == “” || $password == “” || $v_password == “” || $email == “” || $v_email == “”){
header(“Location: register.php?error=4”);
} else {
$connection = mysql_connect($host,$user,$password)
or die (‘Couldnt connect: ‘.$connection.’ – Error: ‘.mysql_error());
$db = mysql_select_db($database, $connection)
or die (‘Couldnt select database: ‘.$db.’ – Error: ‘.mysql_error());
$sql = “SELECT loginName FROM members
WHERE loginName=’$username”;
$result = mysql_query($sql)
or die (‘Couldnt execute query 1: ‘.$sql.’ – Error: ‘.mysql_error());
$num = mysql_num_rows($result);
if ($num != 0){
header(“Location: register.php?error=1”);
} else {
if ($password != $v_password){
header(“Location: register.php?error=2”);
} else {
if ($email != $v_email){
header(“Location: register.php?error=3”);
} else {
$today = date(“Y-m-d”);
$sql = “INSERT INTO members (loginName,createDate,password,email,access)
VALUES(‘$username’,’$today’,md5(‘$password’),’$email’,’0′)”;
mysql_query($sql);
header(“Location: register.compelte.php”);
}
}
}
}
?>