本文整理汇总了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'];
}
}
示例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);
}
示例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.
}
}
示例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'];
}
}