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


PHP PassHash::verify_hash方法代码示例

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


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

示例1: checkPass

 /**
  * Check user+password
  *
  * @param   string $user the user name
  * @param   string $pass the clear text password
  * @return  bool
  */
 public function checkPass($user, $pass)
 {
     $data = $this->_selectUser($user);
     if ($data == false) {
         return false;
     }
     if (isset($data['hash'])) {
         // hashed password
         $passhash = new PassHash();
         return $passhash->verify_hash($pass, $data['hash']);
     } else {
         // clear text password in the database O_o
         return $pass == $data['clear'];
     }
 }
开发者ID:boycaught,项目名称:dokuwiki,代码行数:22,代码来源:auth.php

示例2: auth_verifyPassword

/**
 * Verifies a cleartext password against a crypted hash
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 * @param  string $clear The clear text password
 * @param  string $crypt The hash to compare with
 * @return bool true if both match
 */
function auth_verifyPassword($clear, $crypt)
{
    $pass = new PassHash();
    return $pass->verify_hash($clear, $crypt);
}
开发者ID:AlexanderS,项目名称:Part-DB,代码行数:13,代码来源:auth.php

示例3: fopen

}
if (isset($_SESSION['user'])) {
    $smarty->assign('loggedIn', true);
} else {
    if (isset($_POST['user']) and isset($_POST['password'])) {
        $handle = fopen("DokuWiki/users.auth.php", "r");
        if ($handle) {
            while (($line = fgets($handle)) !== false) {
                if (startsWith($line, $_POST['user'])) {
                    // do the auth
                    $lineExplode = explode(":", $line);
                    if ($lineExplode[0] != $_POST['user']) {
                        continue;
                    }
                    $cHash = new PassHash();
                    if ($cHash->verify_hash($_POST['password'], $lineExplode[1])) {
                        $_SESSION['user'] = $_POST['user'];
                        $_SESSION['groups'] = array_map('trim', explode(",", $lineExplode[4]));
                        $smarty->assign('loggedIn', true);
                        header("Location: index.php");
                        exit;
                    } else {
                        error_log("Login attempt with wrong credentials for user: " . $_POST['user']);
                    }
                }
            }
            fclose($handle);
        } else {
            // error opening the file.
        }
    }
开发者ID:JustKiddingCode,项目名称:apvel,代码行数:31,代码来源:auth.php

示例4: checkPass

 /**
  * Check user+password
  *
  * @param   string $user the user name
  * @param   string $pass the clear text password
  * @return  bool
  */
 public function checkPass($user, $pass)
 {
     $userdata = $this->_selectUser($user);
     if ($userdata == false) {
         return false;
     }
     // password checking done in SQL?
     if ($this->_chkcnf(array('check-pass'))) {
         $userdata['clear'] = $pass;
         $userdata['hash'] = auth_cryptPassword($pass);
         $result = $this->_query($this->getConf('check-pass'), $userdata);
         if ($result === false) {
             return false;
         }
         return count($result) == 1;
     }
     // we do password checking on our own
     if (isset($userdata['hash'])) {
         // hashed password
         $passhash = new PassHash();
         return $passhash->verify_hash($pass, $userdata['hash']);
     } else {
         // clear text password in the database O_o
         return $pass === $userdata['clear'];
     }
 }
开发者ID:splitbrain,项目名称:dokuwiki,代码行数:33,代码来源:auth.php


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