Fix when random_int is not available
This commit is contained in:
parent
415fbc19af
commit
2b3fbecd49
@ -514,7 +514,14 @@ function getRandomPassword($generic=false, $replaceambiguouschars=null)
|
||||
{
|
||||
$numbers = "ABCDEF";
|
||||
$max = strlen($numbers) - 1;
|
||||
$generated_password=str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password);
|
||||
if (function_exists('random_int')) // Cryptographic random
|
||||
{
|
||||
$generated_password=str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password);
|
||||
}
|
||||
else
|
||||
{
|
||||
$generated_password=str_replace($replaceambiguouschars, $numbers{mt_rand(0, $max)}, $generated_password);
|
||||
}
|
||||
}
|
||||
|
||||
return $generated_password;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user