1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 11:13:59 +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

@@ -991,17 +991,10 @@ else
}
$db->sql_freeresult($result);
$confirm_chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9');
list($usec, $sec) = explode(' ', microtime());
mt_srand($sec * $usec);
$max_chars = count($confirm_chars) - 1;
$code = '';
for ($i = 0; $i < 6; $i++)
{
$code .= $confirm_chars[mt_rand(0, $max_chars)];
}
// Generate the required confirmation code
// NB 0 (zero) could get confused with O (the letter) so we make change it
$code = dss_rand();
$code = strtoupper(str_replace('0', 'o', substr($code, 6)));
$confirm_id = md5(uniqid($user_ip));