本文整理汇总了PHP中Dao::saveUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Dao::saveUser方法的具体用法?PHP Dao::saveUser怎么用?PHP Dao::saveUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dao
的用法示例。
在下文中一共展示了Dao::saveUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
// 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:
$_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='/'">