Created
September 13, 2008 01:49
-
-
Save kzsg/10549 to your computer and use it in GitHub Desktop.
elseif elseif elseif ...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!($posteduser) || !($_POST['password']) || !($_POST['email'])) { | |
$tplVars['error'] = T_('You <em>must</em> enter a username, password and e-mail address.') ; | |
// Check if username is reserved | |
} elseif ($userservice->isReserved($posteduser)) { | |
$tplVars['error'] = T_('This username has been reserved, please make another choice.') ; | |
// Check if username already exists | |
} elseif ($userservice->getUserByUsername($posteduser)) { | |
$tplVars['error'] = T_('This username already exists, please make another choice.') ; | |
// Check if e-mail address is valid | |
} elseif (!$userservice->isValidEmail($_POST['email'])) { | |
$tplVars['error'] = T_('E-mail address is not valid. Please try again.') ; | |
// Register details | |
} elseif ($userservice->addUser($posteduser, $_POST['password'], $_POST['email'])) { | |
// Log in with new username | |
$login = $userservice->login($posteduser, $_POST['password']) ; | |
if ($login) { | |
header('Location: '. createURL('bookmarks', $posteduser)) ; | |
} | |
$tplVars['msg'] = T_('You have successfully registered. Enjoy!') ; | |
} else { | |
$tplVars['error'] = T_('Registration failed. Please try again.') ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment