]> git.mxchange.org Git - simple-upload.git/commitdiff
Better use mt_rand() as it produces better random numbers.
authorRoland Häder <roland@mxchange.org>
Tue, 29 Mar 2016 12:25:24 +0000 (14:25 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 29 Mar 2016 12:25:24 +0000 (14:25 +0200)
index.php

index a75b12c07f1e663ac176f79277e1b19f7b4c8910..a8410f23399c0e4a3f7252f32431123462ab6ee2 100644 (file)
--- a/index.php
+++ b/index.php
 
                // 'User ID'
                if (!isset($_SESSION['upload_user_id']))
-                       $_SESSION['upload_user_id'] = rand(100000, 999999);
+                       $_SESSION['upload_user_id'] = mt_rand(100000, 999999);
 
                // List of filenames that were uploaded by this user
                if (!isset($_SESSION['upload_user_files']))
                        do {
                                $file_data['target_file_name'] = '';
                                while (strlen($file_data['target_file_name']) < $settings['random_name_len'])
-                                       $file_data['target_file_name'] .= $settings['random_name_alphabet'][rand(0, strlen($settings['random_name_alphabet']) - 1)];
+                                       $file_data['target_file_name'] .= $settings['random_name_alphabet'][mt_rand(0, strlen($settings['random_name_alphabet']) - 1)];
                                if ($settings['random_name_keep_type'])
                                        $file_data['target_file_name'] .= '.' . pathinfo($file_data['uploaded_file_name'], PATHINFO_EXTENSION);
                        } while (file_exists($file_data['target_file_name']));