本文整理汇总了PHP中USER::email_exists方法的典型用法代码示例。如果您正苦于以下问题:PHP USER::email_exists方法的具体用法?PHP USER::email_exists怎么用?PHP USER::email_exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USER
的用法示例。
在下文中一共展示了USER::email_exists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
include_once '../../../includes/easyparliament/init.php';
$this_page = "userpassword";
$PAGE->page_start();
$PAGE->stripe_start();
if (get_http_var("submitted")) {
// Form's been submitted.
// Where we'll store any errors that occur...
$errors = array();
$email = trim(get_http_var("email"));
if ($email == "") {
$errors["email"] = "Please enter your email address";
} elseif (!validate_email($email)) {
$errors["email"] = "Please enter a valid email address";
} else {
$USER = new USER();
$emailexists = $USER->email_exists($email);
if (!$emailexists) {
$errors["email"] = 'There is no user registered with that email address. If you are subscribed to email alerts, you are not necessarily registered on the website. If you register, you will be able to manage your email alerts, as well as leave annotations.';
}
}
if (sizeof($errors) > 0) {
// Validation errors. Print form again.
display_page($errors);
} else {
// Change the user's password!
$password = $USER->change_password($email);
if ($password) {
$success = $USER->send_password_reminder();
if ($success) {
print "<p>A new password has been sent to " . _htmlentities($email) . "</p>\n";
} else {
示例2: check_input
function check_input($details)
{
global $THEUSER, $this_page, $who;
// This may be a URL that will send the user back to where they were before they
// wanted to join.
$ret = get_http_var("ret");
$errors = array();
// Check each of the things the user has input.
// If there is a problem with any of them, set an entry in the $errors array.
// This will then be used to (a) indicate there were errors and (b) display
// error messages when we show the form again.
// Check first name.
if ($details["firstname"] == "") {
$errors["firstname"] = "Please enter {$who} first name";
}
// They don't need a last name. In case Madonna joins.
// Check email address is valid and unique.
if ($details["email"] == "") {
$errors["email"] = "Please enter {$who} email address";
} elseif (!validate_email($details["email"])) {
// validate_email() is in includes/utilities.php
$errors["email"] = "Please enter a valid email address";
} else {
$USER = new USER();
$id_of_user_with_this_addresss = $USER->email_exists($details["email"]);
if ($this_page == "useredit" && get_http_var("u") == "" && $THEUSER->isloggedin()) {
// User is updating their own info.
// Check no one else has this email.
if ($id_of_user_with_this_addresss && $id_of_user_with_this_addresss != $THEUSER->user_id()) {
$errors["email"] = "Someone else has already joined with this email address";
}
} else {
// User is joining. Check no one is already here with this email.
if ($this_page == "userjoin" && $id_of_user_with_this_addresss) {
$errors["email"] = "There is already a user with this email address";
}
}
}
// Check passwords.
if ($this_page == "userjoin") {
// Only *must* enter a password if they're joining.
if ($details["password"] == "") {
$errors["password"] = "Please enter {$who} password";
} elseif (strlen($details["password"]) < 6) {
$errors["password"] = "Please enter at least six characters";
}
if ($details["password2"] == "") {
$errors["password2"] = "Please enter {$who} password again";
}
if ($details["password"] != "" && $details["password2"] != "" && $details["password"] != $details["password2"]) {
$errors["password"] = ucfirst($who) . " passwords did not match. Please try again.";
}
} else {
// Update details pages.
if ($details["password"] != "" && strlen($details["password"]) < 6) {
$errors["password"] = "Please enter at least six characters";
}
if ($details["password"] != $details["password2"]) {
$errors["password"] = ucfirst($who) . " passwords did not match. Please try again.";
}
}
// Check postcode (which is not a compulsory field).
if ($details["postcode"] != "" && !validate_postcode($details["postcode"])) {
$errors["postcode"] = "Sorry, this isn't a valid Australian postcode.";
}
// No checking of URL.
if ($this_page == "otheruseredit") {
// We're editing another user's info.
// Could check status here...?
}
// Send the array of any errors back...
return $errors;
}