当前位置: 首页>>代码示例>>PHP>>正文


PHP validate::emailAddr方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:ddavisgraphics,项目名称:LearningApp,代码行数:40,代码来源:login.php

示例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>";
开发者ID:ddavisgraphics,项目名称:LearningApp,代码行数:31,代码来源:index.php


注:本文中的validate::emailAddr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。