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


PHP User::getUsername方法代码示例

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


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

示例1: save

 public function save(\model\User $user)
 {
     if ($this->doExists($user->getUsername())) {
         throw new \Exception();
     }
     $stmt = $this->database->prepare("INSERT INTO  `lab4` (`username` , `password`) VALUES (?, ?)");
     if ($stmt === FALSE) {
         throw new \Exception($this->database->error);
     }
     $username = $user->getUsername();
     $password = $user->getPassword();
     $stmt->bind_param('ss', $username, $password);
     $stmt->execute();
 }
开发者ID:rs222kn,项目名称:1DV608_Login,代码行数:14,代码来源:UserDAL.php

示例2: doUserExist

 public function doUserExist(User $user)
 {
     $this->database->prepare('SELECT * FROM users WHERE username = :username');
     $this->database->bindValue(':username', $user->getUsername());
     $this->database->fetchAll();
     if ($this->database->rowCount() > 0) {
         throw new exception\UserAlreadyExistException();
     }
 }
开发者ID:OskarKlintrotSkolarbeteWP14,项目名称:1dv608-Project,代码行数:9,代码来源:RegistrationDAL.php

示例3: addUser

 /**
  * @return bool
  * Encrypts password with the php 5.5 hashing API (uses BCrypt)
  */
 public function addUser(\model\User $user)
 {
     $successfulRegistration = false;
     $users = $this->getAllUsers();
     if ($users->isInList($user->getUsername())) {
         throw new \UserAlreadyExistException("User exists, pick another username.");
     }
     try {
         $db = $this->db->getConnection();
         $sql = "INSERT INTO {$this->dbTable} (" . self::$usernameColumn . ", " . self::$passwordColumn . ") VALUES (?, ?)";
         $params = array($user->getUsername(), password_hash($user->getPassword(), PASSWORD_DEFAULT));
         $query = $db->prepare($sql);
         $query->execute($params);
         $successfulRegistration = true;
     } catch (\PDOException $e) {
         die("Database error, please try again later");
     }
     return $successfulRegistration;
 }
开发者ID:kk222hk,项目名称:1dv608-laborations,代码行数:23,代码来源:UserRepository.php

示例4: removeFollowee

 /**
  * Used when the person who is currently logged in wants to stop following another user
  * @param User $user, person who is already following
  * @param $followee, a person who is being followed
  * @return bool
  */
 public function removeFollowee(\model\User $user, $followee)
 {
     $follower = $user->getUsername();
     try {
         DB::getInstance()->deleteFollowee($follower, $followee);
         return true;
     } catch (\Exception $e) {
         return false;
     }
 }
开发者ID:Janste,项目名称:PHP_MVC_Simple_Social_Network,代码行数:16,代码来源:Followers.php

示例5: addNewStatus

 public function addNewStatus(\model\User $user, $content)
 {
     if (strlen($content) > 255) {
         return false;
     }
     try {
         $username = $user->getUsername();
         DB::getInstance()->addStatusToDB($username, $content);
         return true;
     } catch (\Exception $e) {
         return false;
     }
 }
开发者ID:Janste,项目名称:PHP_MVC_Simple_Social_Network,代码行数:13,代码来源:StatusHandler.php

示例6: doLogin

 /**
  * Login user
  *
  * @param \model\User $credential
  * @return bool
  */
 public function doLogin(\model\User $credential)
 {
     $username = $credential->getUsername();
     $password = $credential->getPassword();
     $records = new \Db();
     $records->query('SELECT username, password FROM users WHERE BINARY username = :username');
     $records->bind(':username', $username);
     $results = $records->single();
     if (count($results) > 0 && password_verify($password, $results['password'])) {
         return $this->sessionStorage->set(SessionStorage::$auth, $username);
     } else {
         return false;
     }
 }
开发者ID:rn222cx,项目名称:project_1DV608,代码行数:20,代码来源:User.php

示例7: doExist

 public function doExist(\model\User $user)
 {
     $sqlQuery = $this->dal->prepare("SELECT EXISTS(SELECT 1 FROM Users WHERE Username=?)");
     if ($sqlQuery == false) {
         throw new \Exception($this->dal->error);
     }
     $username = $user->getUsername();
     $sqlQuery->bind_param('s', $username);
     $sqlQuery->execute();
     $sqlQuery->bind_result($result);
     $sqlQuery->fetch();
     if ($result == 1) {
         return true;
     }
     return false;
 }
开发者ID:ksvenzzon,项目名称:Registration,代码行数:16,代码来源:memberDAL.php

示例8: response

    /**
     * Generate user profile
     * @return String   	HTML-code
     */
    public function response()
    {
        return '<h1>' . $this->user->getUsername() . '</h1>
			' . $this->setInfo();
    }
开发者ID:ea222pu,项目名称:1DV608-Project,代码行数:9,代码来源:UserProfileView.php


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