Better randomizer chossen (rand() does only create 32767 different numbers under...
authorRoland Häder <roland@mxchange.org>
Thu, 9 Oct 2008 16:44:36 +0000 (16:44 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 9 Oct 2008 16:44:36 +0000 (16:44 +0000)
inc/databases.php
inc/gen_sql_patches.php
inc/mails/birthday_mails.php
inc/modules/member/what-transfer.php
mailid_top.php

index 9417e4c..f8e8a8b 100644 (file)
@@ -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);
index 467e4b4..8c54d29 100644 (file)
@@ -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
index 71a6169..c4dab04 100644 (file)
@@ -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
index 7e00b7a..2b61e4b 100644 (file)
@@ -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', "<INPUT type=\"hidden\" name=\"code_chk\" value=\"".$rand."\"><INPUT type=\"text\" name=\"code\" class=\"member_normal\" size=\"5\" maxlength=\"7\"".__TRANSFER_TO_DISABLED.">&nbsp;".$img);
index f2829ac..5504788 100644 (file)
@@ -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