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


PHP Password::checkPassword方法代码示例

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


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

示例1: checkLogin

 /**
  * @param string $username
  * @param string $password
  *
  * @return bool
  */
 public static function checkLogin($username, $password)
 {
     $p = Db::query('SELECT username, password FROM zz_users WHERE username = :username', array(':username' => $username), 0);
     if (!empty($p[0])) {
         $pw = $p[0]['password'];
         if (Password::checkPassword($password, $pw)) {
             return true;
         }
         return false;
     }
     return false;
 }
开发者ID:Nord001,项目名称:zKillboard,代码行数:18,代码来源:User.php

示例2: elseif

 if (isset($viewtheme)) {
     UserConfig::set("viewtheme", $viewtheme);
     $app->redirect($_SERVER["REQUEST_URI"]);
 }
 $theme = Util::getPost("theme");
 if (isset($theme)) {
     UserConfig::set("theme", $theme);
 }
 $orgpw = Util::getPost("orgpw");
 $password = Util::getPost("password");
 $password2 = Util::getPost("password2");
 // Password
 if (isset($orgpw) && isset($password) && isset($password2)) {
     if ($password != $password2) {
         $error = "Passwords don't match, try again";
     } elseif (Password::checkPassword($orgpw) == true) {
         Password::updatePassword($password);
         $error = "Password updated";
     } else {
         $error = "Original password is wrong, please try again";
     }
 }
 $timeago = Util::getPost("timeago");
 if (isset($timeago)) {
     UserConfig::set("timeago", $timeago);
 }
 $deleteentityid = Util::getPost("deleteentityid");
 $deleteentitytype = Util::getPost("deleteentitytype");
 // Tracker
 if (isset($deleteentityid) && isset($deleteentitytype)) {
     $q = UserConfig::get("tracker_" . $deleteentitytype);
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:31,代码来源:account.php

示例3: isValidPassword

 /**
  * @brief Compare plain text password to the password saved in DB
  * @param string $hashed_password The hash that was saved in DB
  * @param string $password_text The password to check
  * @param int $member_srl Set this to member_srl when comparing a member's password (optional)
  * @return bool
  */
 function isValidPassword($hashed_password, $password_text, $member_srl = null)
 {
     // False if no password in entered
     if (!$password_text) {
         return false;
     }
     // Check the password
     $oPassword = new Password();
     $current_algorithm = $oPassword->checkAlgorithm($hashed_password);
     $match = $oPassword->checkPassword($password_text, $hashed_password, $current_algorithm);
     if (!$match) {
         return false;
     }
     // Update the encryption method if necessary
     $config = $this->getMemberConfig();
     if ($member_srl > 0 && $config->password_hashing_auto_upgrade != 'N') {
         $need_upgrade = false;
         if (!$need_upgrade) {
             $required_algorithm = $oPassword->getCurrentlySelectedAlgorithm();
             if ($required_algorithm !== $current_algorithm) {
                 $need_upgrade = true;
             }
         }
         if (!$need_upgrade) {
             $required_work_factor = $oPassword->getWorkFactor();
             $current_work_factor = $oPassword->checkWorkFactor($hashed_password);
             if ($current_work_factor !== false && $required_work_factor > $current_work_factor) {
                 $need_upgrade = true;
             }
         }
         if ($need_upgrade === true) {
             $args = new stdClass();
             $args->member_srl = $member_srl;
             $args->hashed_password = $this->hashPassword($password_text, $required_algorithm);
             $oMemberController = getController('member');
             $oMemberController->updateMemberPassword($args);
         }
     }
     return true;
 }
开发者ID:kimkucheol,项目名称:xe-core,代码行数:47,代码来源:member.model.php


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