Hi there, im trying to write a user registration process, but i keep coming up against this error, "Parse error: parse error, unexpected $ in /home/errosorg/public_html/inc/register_func.php on line 178"
Line 178 is the end of the script so i assumed that i hadnt closed off a curly bracket. ive checked and all seems well but i am totaly lost NE ideas greatly appreciated... oh and heres the code!
function user_register() {
global $supersecret_hash_padding;
//debug
$_SERVER='ikky1';
$user_name='bob';
$last_name='trev';
$email='s@a.bom';
$user_ip='192.168.0.3';
$first_name='danny';
$password='ikkyboy';
//are all vars present and paswords match?
if (strlen($_POST['user_name']) <= 25 && strlen($_POST['password1'])
<= 25 && ($_POST['password1'] == $_POST['password2']) &&
strlen($_POST['email']) <= 50 && validate_email($_POST['email'])) {
//validate un and pw
if (account_namevalid($_POST['user_name']) ||
strlen($_POST['password1'] >=6)) {
$user_name = strtolower($_POST['user_name']);
$user_name = trim($user_name);
$email = $_POST['email'];
//dont allow duplicate un or pw
$query = "SELECT id
FROM auth
WHERE un = '$user_name'
AND email = '$email'";
$result = mysql_query($query);
if ($result && mysql_num_rows($result) > 0) {
$feedback = 'ERROR - Username or email address already exists';
return $feedback;
}else{
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$password = md5($_POST['password1']);
$user_ip = $_SERVER['REMOTE_ADDR']; //check <-=
//create new hash to insert into DB and conf email
$hash = md5($email.$supersecret_hash_padding);
$query = "INSERT
INTO auth (un, 1st, last, pw, email, userIP, confirm_hash, is_confirmed, date_created)
VALUES ('$user_name', '$first_name', '$last_name', '$password', '$email', '$user_ip', '$hash', '0', NOW())";
$result= mysql_query($query);
if (!$result) {
$feedback = 'ERROR - Database error';
return $feedback;
}else{
//send confirmation email
$encoded_email = urlencode($_POST['email']);
$mail_body = <<< EOMAILBODY
Thankyou for registering at $sitevariable Click this link to confirm your registration //make the email an include file!
http://$sitevariable/inc/confirm.php?ha ... oded_email
Once you see a confirmation message, you will be logged into $sitevariable
EOMAILBODY;
mail ($email, $sitevariable, 'Registration confirmation',$mail_body, 'From: register@',$siteadd)
//if succcesful
$feedback = 'CONGRATULATIONS, YOU HAVE SUCCESSFULLY REGISTERED. You will recieve a confirmation email soon';
return $feedback;
}
}
}else{
$feedback = 'ERROR - Username or password is invalid';
return $feedback;
}
}else{
$feedback = 'ERROR - please fill all fields in correctly';
return $feedback;
}
}


