Ok,
I have been battling with this registration form for the last month. Please someone point me in the correct direction.
Below is the main function that should insert the new user data into the database.
/Register a new user
function lumos_register( $username, $password, $fields=NULL ){
global $db;
$username = $username;
$password = $password;
$sha1password = sha1($password);
$time = time();
$fieldnames = '';
$fieldvalues = '';
if($fields){
foreach($fields as $name => $value){
$fieldnames .= ", `$name`";
$fieldvalues .= ", '$value'";
}
}
$query = "INSERT INTO lumos_users ( `username`, `password`, `registered` $fieldnames ) VALUES ( '$username' , '$sha1password' , $time $fieldvalues );";
if(lumos_query($query)){
return true;
}
else{
return false;
}
}
Below is an extract from the main page that calls the function above.
if(empty($msg)){
$ipaddress = $_POST['ipaddress'];
$username = $_POST['username'];
$password = $_POST['password1'];
$email = $_POST['email'];
$location = $_POST['location'];
$fields = array('email'=>$email,'location'=>$location);
//Now register
$reg = lumos_register($username,$password,$fields);
if(!$reg){
$msg = "Could not register. Please try again.";
}
else{
//Then log the user in and redirect to index
header("Location: index.php");
}
}else{
$alert = displayAlert($msg);
}
I have not included all the code above this that does various checks of user data, only because i am pretty sure it is not interfering.
At present, after i submit, the form does not return a registration completed or failed, just shows the form with some data in some fields?