From: Roland Häder Date: Thu, 9 Oct 2008 16:44:36 +0000 (+0000) Subject: Better randomizer chossen (rand() does only create 32767 different numbers under... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7ca7fc19533794f4cec43d8e9767d1c137148a8a;p=mailer.git Better randomizer chossen (rand() does only create 32767 different numbers under Windows!) --- diff --git a/inc/databases.php b/inc/databases.php index 9417e4c79b..f8e8a8be05 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -113,7 +113,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "480"); +define('CURR_SVN_REVISION', "481"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/gen_sql_patches.php b/inc/gen_sql_patches.php index 467e4b4ecb..8c54d294aa 100644 --- a/inc/gen_sql_patches.php +++ b/inc/gen_sql_patches.php @@ -77,7 +77,7 @@ if (empty($_CONFIG['file_hash'])) { if ($fp != false) { // Could write to secret file! So let's generate the secret key... // 1. Count of chars to be taken from back of the string - $nums = rand(40, 45); + $nums = mt_rand(40, 45); // 2. Generate secret key from a randomized string $secretKey = substr(generateHash(GEN_PASS(rand(128, 256))), -$nums); // 3. Write the key to the file diff --git a/inc/mails/birthday_mails.php b/inc/mails/birthday_mails.php index 71a616909f..c4dab04700 100644 --- a/inc/mails/birthday_mails.php +++ b/inc/mails/birthday_mails.php @@ -81,7 +81,7 @@ if (SQL_NUMROWS($result_birthday) > 0) { ); for ($idx = 0; $idx < 4; $idx++) { - $content['check'] .= GEN_RANDOM_CODE("8", rand(0, "$MONTH$DAY"), $uid, ($AGE*($idx+1))); + $content['check'] .= GEN_RANDOM_CODE("8", mt_rand(0, "$MONTH$DAY"), $uid, ($AGE*($idx+1))); } // Insert row into database diff --git a/inc/modules/member/what-transfer.php b/inc/modules/member/what-transfer.php index 7e00b7a188..2b61e4b0a5 100644 --- a/inc/modules/member/what-transfer.php +++ b/inc/modules/member/what-transfer.php @@ -181,7 +181,7 @@ case "new": // Start new transfer } // Generate tranafer id - define('__TRANS_ID', bigintval(GEN_RANDOM_CODE("10", rand(0, 99999), $GLOBALS['userid'], $_POST['reason']))); + define('__TRANS_ID', bigintval(GEN_RANDOM_CODE("10", mt_rand(0, 99999), $GLOBALS['userid'], $_POST['reason']))); // Add entries to both tables $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_transfers_in (userid, from_uid, points, reason, time_trans, trans_id) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP(),'%s')", @@ -304,7 +304,7 @@ case "new": // Start new transfer // Generate Code if ($_CONFIG['transfer_code'] > 0) { - $rand = rand(0, 99999); + $rand = mt_rand(0, 99999); $code = GEN_RANDOM_CODE($_CONFIG['transfer_code'], $rand, $GLOBALS['userid'], __TRANSFER_MAX_VALUE); $img = GENERATE_IMAGE($code, false); define('__TRANSFER_IMAGE_INPUT', " ".$img); diff --git a/mailid_top.php b/mailid_top.php index f2829ac315..5504788e82 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -322,7 +322,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) define('_UID_VALUE' , $url_uid ); define('_TYPE_VALUE', $type); define('_DATA_VALUE', $DATA); - define('_RAND_VALUE', rand(0, 99999)); + define('_RAND_VALUE', mt_rand(0, 99999)); define('_TEMPLATE_BANNER', LOAD_TEMPLATE("mailid_banner", true)); // Load template