本文整理匯總了PHP中Crypto::generateRandomPassword方法的典型用法代碼示例。如果您正苦於以下問題:PHP Crypto::generateRandomPassword方法的具體用法?PHP Crypto::generateRandomPassword怎麽用?PHP Crypto::generateRandomPassword使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Crypto
的用法示例。
在下文中一共展示了Crypto::generateRandomPassword方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: renewPassword
function renewPassword($c)
{
$plain = Crypto::generateRandomPassword(15);
$info = DbManager::i()->select("sf_members", array("key", "iv"), array("userid" => intval($c)));
if ($info !== false && !is_array($info)) {
$key = base64_decode(base64_decode($info->key));
$iv = base64_decode(base64_decode($info->iv));
$password = base64_encode(base64_encode(Crypto::EncryptString($key, $iv, $plain)));
if (DbManager::i()->update("sf_members", array("password" => $password), array("userid" => intval($c)))) {
unset($password);
unset($key);
unset($iv);
unset($info);
Logger::i()->writeLog("Password renewed for UserID: {$c}, password = {$plain}");
return Submission::createResult($plain, true);
}
}
Logger::i()->writeLog("Renew password failed, error = " . DbManager::i()->error, 'dev');
return Submission::createResult("Could not renew password");
}