1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-22 16:22:58 +02:00

Time to roll the dice and see what number comes up :)

[Replace calls to rand/mt_rand in certain places with an alternative method]


git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@5589 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Graham Eames
2006-02-26 17:35:17 +00:00
parent e5f594466d
commit c3c7a5f332
9 changed files with 45 additions and 32 deletions

View File

@@ -60,18 +60,9 @@ $server_url = $server_protocol . $server_name . $server_port . $script_name;
//
function gen_rand_string($hash)
{
$chars = array( 'a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F', 'g', 'G', 'h', 'H', 'i', 'I', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N', 'o', 'O', 'p', 'P', 'q', 'Q', 'r', 'R', 's', 'S', 't', 'T', 'u', 'U', 'v', 'V', 'w', 'W', 'x', 'X', 'y', 'Y', 'z', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0');
$max_chars = count($chars) - 1;
srand( (double) microtime()*1000000);
$rand_str = '';
for($i = 0; $i < 8; $i++)
{
$rand_str = ( $i == 0 ) ? $chars[rand(0, $max_chars)] : $rand_str . $chars[rand(0, $max_chars)];
}
$rand_str = dss_rand();
return ( $hash ) ? md5($rand_str) : $rand_str;
return ( $hash ) ? md5($rand_str) : substr($rand_str, 8);
}
//
// End page specific functions