本文整理汇总了PHP中Password::Password方法的典型用法代码示例。如果您正苦于以下问题:PHP Password::Password方法的具体用法?PHP Password::Password怎么用?PHP Password::Password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Password
的用法示例。
在下文中一共展示了Password::Password方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Validate
/**
* Validates if a hashed password is the correct hashed password for a given raw password, username and salt
* @param string $Username
* @param string $RawPassword the textual password (entered by user at login)
* @param string $HashedPassword the hashed password (retrived from database)
* @param string $Salt the dynamic salt (from database)
* @param integer $Protocol optional for backward compatibility
* @return boolean
*/
static function Validate($Username, $RawPassword, $HashedPassword, $Salt, $Protocol = null)
{
$temp = new Password($Username, $RawPassword, $Protocol);
$temp->Make($Username, $RawPassword, $Salt, $Protocol);
return $temp->Password() == $HashedPassword;
}
示例2: CreateUser
/**
Creates a new user in the system
@param Username of the new user
@param Password of the new user
@return integer UserID on success
null on User Already Exists
*/
function CreateUser($Username, $Password)
{
$Result = $this->UserExists($Username);
if ($Result) {
return null;
}
$HashedPass = new Password($Username, $Password);
$Result = jf::SQL("INSERT INTO {$this->TablePrefix()}users (Username,Password,Salt,Protocol)\n\t\t\tVALUES (?,?,?,?)", $Username, $HashedPass->Password(), $HashedPass->Salt(), $HashedPass->Protocol());
return $Result;
}