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


PHP UserDAO::createUser方法代码示例

本文整理汇总了PHP中UserDAO::createUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDAO::createUser方法的具体用法?PHP UserDAO::createUser怎么用?PHP UserDAO::createUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserDAO的用法示例。


在下文中一共展示了UserDAO::createUser方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executeNew

 public function executeNew(sfWebRequest $request)
 {
     if ($request->getMethod() != "POST") {
         return;
     }
     $this->username = $request->getPostParameter("username");
     if (!$this->username) {
         return $this->setErrorMsg("Username is a required field!");
     }
     $this->user = UserDAO::getUser($this->username);
     if ($this->user) {
         return $this->setErrorMsg("That username is already in use!");
     }
     $this->password1 = $request->getPostParameter("password1");
     $this->password2 = $request->getPostParameter("password2");
     if (!$this->password1 || !$this->password2) {
         return $this->setErrorMsg("Password is a required field");
     }
     if ($this->password1 != $this->password2) {
         return $this->setErrorMsg("Password and password confirm must match!");
     }
     $this->email = $request->getPostParameter("email");
     $this->user = UserDAO::createUser($this->username, $this->password1, $this->email);
     $this->login($this->user);
     $this->redirect("dashboard/index");
 }
开发者ID:rmillsap,项目名称:missionsolutions,代码行数:26,代码来源:actions.class.php

示例2: checkNewUser

 public function checkNewUser($username, $name, $surname, $email, $password)
 {
     switch (FALSE) {
         case check_valid_input($username, 6):
             throw new InvalidInputException("false Username Input = input needs to be minimum 6 long, only numbers, letters, capital letters and # @ . - or _");
         case check_valid_input($name, 1):
         case check_no_numbers($name):
             throw new InvalidInputException("false name Input = input needs to be minimum 1 long, only letters, capital letters and # @ . - or _");
         case check_valid_input($surname, 1):
         case check_no_numbers($surname):
             throw new InvalidInputException("false surname Input = input needs to be minimum 1 long, only letters, capital letters and # @ . - or _");
         case check_valid_input($email, 6):
         case check_at($email):
             throw new InvalidInputException("false email Input = input needs to be minimum 6 long, only numbers, letters, capital letters and # @ . - or _");
         case check_password($password):
             throw new InvalidInputException("false password Input = input needs to be minimum 6 long, only numbers, letters, capital letters and # @ . - or _");
     }
     $hashedpwd = passwordEncrypt($username, $password);
     $userDAO = new UserDAO();
     $userDAO->createUser($username, $name, $surname, $email, $hashedpwd);
 }
开发者ID:liesenborghspuntkristof,项目名称:php_oefeningen,代码行数:21,代码来源:UserService.php

示例3: array

        var_dump($resultSet);
        $lijst = array();
        foreach ($resultSet as $rij) {
            $u = new User($rij["gebruikersnaam"], $rij["wachtwoord"]);
            array_push($lijst, $u);
        }
        var_dump($lijst);
        $dbh = null;
        return $lijst;
    }
}
$userDAO = new UserDAO();
$users = $userDAO->getAll();
var_dump($users);
$userDOA = new UserDAO();
$newUser = $userDAO->createUser("liesenborghs", "testpwd");
var_dump($newUser);
//class UserService {
//
//    public function storeUser($username, $password) {
//        $userDAO = new UserDAO();
//        $userDAO->createUser($username, $password);
//    }
//
//    public function checkUser($username, $password) {
//        $count = 0;
//        $userDAO = new UserDAO();
//        $userDAO->getAll();
//
//        foreach ($userDAO as $user) {
//            if ($user->getUsername() == $username && $user->getPassword() == $password) {
开发者ID:liesenborghspuntkristof,项目名称:php_oefeningen,代码行数:31,代码来源:tester.php

示例4: storeUser

 public function storeUser($username, $password)
 {
     $userDAO = new UserDAO();
     $userDAO->createUser($username, $password);
 }
开发者ID:liesenborghspuntkristof,项目名称:php_oefeningen,代码行数:5,代码来源:tester.php

示例5: storeUser

 public function storeUser($username, $password)
 {
     $userDAO = new UserDAO();
     $newUser = $userDAO->createUser($username, $password);
     return $newUser;
 }
开发者ID:liesenborghspuntkristof,项目名称:php_oefeningen,代码行数:6,代码来源:UserService.php

示例6: password

        if ($passwd != $passwd2) {
            $warnings[] = "Passwords don't match";
        }
        if (!isValidPassword($passwd)) {
            $warnings[] = "Not a valid password (longer than " . MIN_PASSWORD_LENGTH . " characters required)";
        }
        if (!isValidUsername($username)) {
            $warnings[] = "Not a valid username (longer than " . MIN_USERNAME_LENGTH . " characters required)";
        }
        // No warnings means everything is in order, and we can create the user
        if (count($warnings) == 0) {
            $dao = new UserDAO();
            if ($dao->userExists($username)) {
                $warnings[] = "Username already taken";
            } else {
                $passwd = pw_encode($passwd);
                if (!$dao->createUser($username, $passwd)) {
                    $warnings[] = "Failed to insert to database";
                } else {
                    // Registration was successful, redirect the user to
                    // the login screen
                    $session->set('register_flag', true);
                    header("Location: login.php");
                    exit;
                }
            }
        }
    }
}
// Include the HTML template:
require __DIR__ . '/../templates/register.php';
开发者ID:Replica94,项目名称:SysProjE,代码行数:31,代码来源:register.php


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