예제 #1
0
// Check if email is empty
if ($phone == '') {
    $SYSTEM_MSG[] = "Phone number cannot be empty.";
    $errflag = true;
}
// Check if password comparator is empty and if it is match with password
if ($cpass == '' || $password != $cpass) {
    $SYSTEM_MSG[] = 'The password you have typed does not match.';
    $errflag = true;
}
// Check if it is a valid E-mail address
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
    $SYSTEM_MSG[] = "{$email} is not a valid E-mail address.";
    $errflag = true;
}
// Check if password is too weak
if (strlen($password) <= 6) {
    $SYSTEM_MSG[] = "Password must be longer than 6 character.";
    $errflag = true;
}
if ($errflag == false) {
    $dao->saveUser($email, $fname, $lname, $phone, $password);
} else {
    $_SESSION['SYSTEM_MSG'] = $SYSTEM_MSG;
    session_write_close();
    header("location: signup.php");
    $errflag = false;
    exit;
}
header("Location:login.php");
//}
예제 #2
0
        $_SESSION["sign_up_form_errors"] = true;
        $_SESSION["sign_up_email_error"] = "A valid email is required";
        $_SESSION["email"] = $email;
    }
}
if (empty($_POST["password"])) {
    $_SESSION["sign_up_form_errors"] = true;
    $_SESSION["sign_up_password_error"] = "A password is required";
    $_SESSION["email"] = $email;
} else {
    $password = $pass->crypt_pass($_POST['password']);
}
if (!$_SESSION["sign_up_form_errors"]) {
    $user = $dao->getUser($email);
    if (is_null($user["email"])) {
        $dao->saveUser($first, $last, $email, $password);
        $user = $dao->getUser($email);
        $_SESSION["name"] = $first;
        $_SESSION["email"] = $email;
        $_SESSION["user_id"] = $user["id"];
    } else {
        $_SESSION["sign_up_form_errors"] = true;
        $_SESSION["sign_up_email_error"] = "This account already exists";
    }
}
?>
<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="refresh" content="0; url='/'">