本文整理汇总了PHP中validate::emailAddr方法的典型用法代码示例。如果您正苦于以下问题:PHP validate::emailAddr方法的具体用法?PHP validate::emailAddr怎么用?PHP validate::emailAddr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validate
的用法示例。
在下文中一共展示了validate::emailAddr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerUser
/**
* =========================================================
* Registers the users and puts them into the db
* =========================================================
**/
public static function registerUser($username, $password, $email)
{
$engine = EngineAPI::singleton();
$localvars = localvars::getInstance();
$db = db::get($localvars->get('dbConnectionName'));
$sql = "INSERT INTO `users`(username,password,emailAddress,ipAddr) VALUES(?,?,?,?)";
$validate = new validate();
$ip = $_SERVER['REMOTE_ADDR'];
$db->beginTransaction();
try {
// prep for database
$email = dbSanitize($email);
$password = dbSanitize($password);
$username = dbSanitize($username);
$password = self::protectPassword($password);
if (!$validate->emailAddr($email)) {
throw new Exception('Email is invalid');
}
if (self::checkEmail($email)) {
throw new Exception('Email is already being used please login instead');
}
if (!self::checkUsername($username)) {
$sqlResult = $db->query($sql, array($username, $password, $email, $ip));
if ($sqlResult->error()) {
throw new Exception("Error Getting Entries");
}
$db->commit();
return true;
}
} catch (Exception $e) {
$db->rollback();
errorHandle::errorMsg($e->getMessage());
return false;
}
}
示例2: validate
templates::display('header');
$validate = new validate();
if (isset($_POST['MYSQL'])) {
$data = $_POST['MYSQL'];
$password = $data['password'];
$confirmPass = $data['confirmPassword'];
$email = $data['emailAddress'];
$username = $data['username'];
$errors = array();
if ($password !== $confirmPass) {
$errors['password'] = "passwords do not match";
}
if (count($password) >= 8) {
$errors['passwordLength'] = "password is not long enough";
}
if (!$validate->emailAddr($email)) {
$errors['email'] = "email is not valid";
}
if (LoginAuth::checkEmail($email)) {
$errors['email'] = "user email is already in the system, please try logging in";
}
if (LoginAuth::checkUsername($username)) {
$errors['username'] = "user exsists, please pick a different username";
}
if (is_empty($errors)) {
$test = LoginAuth::registerUser($username, $password, $email);
$succString = "<div class='alert alert-success'> <strong> {$username} Congrats </strong>, you have been registered. </div>";
$localvars->set('feedback', $succString);
header("refresh:3;url=/login");
} else {
$errorString = "<div class='alert alert-danger'><ul><li>" . implode("</li><li>", $errors) . "</li></ul></div>";