From 9df6b75f325533fde4c121872a3ce62523ff2312 Mon Sep 17 00:00:00 2001 From: David M Date: Sat, 9 Dec 2006 19:17:01 +0000 Subject: proper solution to #6114, guarantees $seed lies below 0x7FFFFFFF git-svn-id: file:///svn/phpbb/trunk@6731 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/posting.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'phpBB/posting.php') diff --git a/phpBB/posting.php b/phpBB/posting.php index 9b33a9ab62..fbc91b47b9 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1130,10 +1130,8 @@ if ($config['enable_post_confirm'] && !$user->data['is_registered'] && $solved_c $confirm_id = md5(unique_id($user->ip)); $seed = hexdec(substr(unique_id(), 4, 10)); - if ($seed > 0x7FFFFFFF) - { - $seed -= 0x7FFFFFFF; - } + // compute $seed % 0x7fffffff + $seed -= 0x7fffffff * floor($seed / 0x7fffffff); $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( 'confirm_id' => (string) $confirm_id, -- cgit v1.2.1