Ejemplo n.º 1
0
    echo "This page must be requested using POST.";
    die;
}
// Insterting new user.
if (empty($_POST['id'])) {
    $user = new RegisteredUser();
}
// Making sure all fields are valid.
if (formValidation()) {
    // Saving user to database.
    $user->email = $_POST['email'];
    $user->displayName = $_POST['displayName'];
    $user->dateRegistered = date("Y-m-d H:i:s");
    $user->dateLastLoggedIn = date("Y-m-d H:i:s");
    $user->setPassword($_POST['password']);
    $user->createVerificationHash();
    $user->save();
    // Generating a verification email.
    $message = new Message();
    $message->recipientId = $user->id;
    $message->subject = 'PAWS Signup Verification';
    $message->body = 'Thanks for signing up for an account at PAWS!

Your account has been created but is inactive until you click the link:
http://www.sfsuswe.com/~s15g08/verify.php?email=' . $user->email . '&hash=' . $user->verificationHash . '
';
    MessagingService::getInstance()->emailMessage($message);
    $_SESSION["successmsg"] = "Registration successful. Please check your email" . " to validate your account.";
    header('Location: ../verify.php?email=' . $user->email . '&hash=' . $user->verificationHash);
    //header('Location: ../user-confirmation.php');
    // Failed to validate. Go back to registration page an display error message.