Tuesday, 20 August 2013

PHP Parse error: syntax error, unexpected '; ', expecting function (T_FUNCTION)

PHP Parse error: syntax error, unexpected '; ', expecting function
(T_FUNCTION)

I'm trying to make a script check if it has an email address like the one
specified already in the database. I've been playing with it a long time
but I'm getting the error above and can't seem to understand from where
it's coming. This is the code:
global $session, $form, $mailer;
$email = $_POST['email'];
$currentemail = $session->userinfo['email'];
if($email !== $currentemail) {
if($database->emailInUse($email)) {
header("Location: error.php");
}else{
/* Account edit attempt - Will change the email address */
$retval = $session->editAccount($_POST['curpass'],
$_POST['newpass'], $_POST['email'], $_POST['firstname'],
$_POST['lastname'], $_POST['photourl'], $_POST['gender'],
$_POST['country'], $_POST['year'], $_POST['notebook']);
/* Account edit successful */
if($retval){
$username = $session->username;
$q = "UPDATE ".TBL_USERS." SET confirmed = '0' WHERE username
= '$username'";
mysql_query($q);
$mail = $mailer->sendConfirmEmail($session->username,
$_POST['email'], $session->userinfo['confirm_id']);
if($mail){
$_SESSION['confirmation'] = true;
}else{
$_SESSION['confirmation'] = false;
};
$_SESSION['useredit'] = true;
header("Location: ".$session->referrer);
}
/* Error found with form */
else{
$_SESSION['value_array'] = $_POST;
$_SESSION['error_array'] = $form->getErrorArray();
header("Location: ".$session->referrer);
};
};
}else{
/* Email Address is the same */
/* Account edit attempt */
$retval = $session->editAccount($_POST['curpass'],
$_POST['newpass'], $_POST['email'], $_POST['firstname'],
$_POST['lastname'], $_POST['photourl'], $_POST['gender'],
$_POST['country'], $_POST['year']);
/* Account edit successful */
if($retval){
$_SESSION['useredit'] = true;
header("Location: ".$session->referrer);
}
/* Error found with form */
else{
$_SESSION['value_array'] = $_POST;
$_SESSION['error_array'] = $form->getErrorArray();
header("Location: ".$session->referrer);
};
};
Can anyone help me?

No comments:

Post a Comment