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


PHP User::GetUserName方法代码示例

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


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

示例1: SaveLoginOnClient

 public function SaveLoginOnClient(\model\User $user)
 {
     // Prepare values
     $cookieValues = implode(':', array($user->GetUserName(), $user->GetToken(), $user->GetSignature()));
     // Save values in cookie (expires in 30 days)
     return setcookie(self::$COOKIE_ID, $cookieValues, time() + 60 * 60 * 24 * self::$COOKIE_VALID_DAYS);
 }
开发者ID:johnnypesola,项目名称:1dv608-php-project,代码行数:7,代码来源:LoginView.php

示例2: Add

 public function Add(\model\User $user)
 {
     if ($this->GetRegistrationsForHour() > self::$MAX_REGISTRATIONS_PER_HOUR) {
         throw new \Exception("Max number of registrations per hour reached. Please try again in 30-60 minutes.");
     }
     // Throw exception if username is taken
     if ($this->GetUserByUsername($user->GetUserName())) {
         throw new \Exception(self::$DB_USERNAME_EXISTS);
     }
     try {
         // Prepare db statement
         $statement = self::$db->prepare('INSERT INTO ' . self::$DB_TABLE_NAME . ' (user_id, user_name, user_firstname, user_surname, user_password, created)' . ' VALUES ' . '(NULL, :userName, :firstName, :surName, :password, NOW())');
         // Prepare input array
         $inputArray = ['userName' => $user->GetUserName(), 'firstName' => $user->GetFirstName(), 'surName' => $user->GetSurName(), 'password' => $user->GetPassword()];
         // Execute db statement
         $statement->execute($inputArray);
         // Check if db insertion was successful
         return $statement->rowCount() == 1;
     } catch (\Exception $exception) {
         throw new \Exception(self::$DB_INSERT_ERROR);
     }
 }
开发者ID:johnnypesola,项目名称:1dv608-php-project,代码行数:22,代码来源:UserDAL.php

示例3: GetUserLoginsForHour

 public function GetUserLoginsForHour(\model\User $user)
 {
     try {
         $returnArray = [];
         // Prepare db statement
         $statement = self::$db->prepare('SELECT * FROM ' . self::$DB_TABLE_NAME . ' WHERE `user_name` = :userName AND ' . ' `created` LIKE \'' . date("Y-m-d H") . '%\'');
         // Prepare input array
         $inputArray = ['userName' => $user->GetUserName()];
         // Execute db statement
         $statement->execute($inputArray);
         // Fetch rows
         $userRowsArray = $statement->fetchAll();
         return sizeOf($userRowsArray);
     } catch (\Exception $exception) {
         throw new \Exception(self::$DB_QUERY_ERROR);
     }
 }
开发者ID:johnnypesola,项目名称:1dv608-php-project,代码行数:17,代码来源:LoginDAL.php

示例4: SetLoginUsername

 public function SetLoginUsername(\model\User $user)
 {
     $_SESSION['last_login_uname'] = $user->GetUserName();
 }
开发者ID:johnnypesola,项目名称:1dv608-Assignment-2,代码行数:4,代码来源:AuthService.php


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