From 69ad885419740b330979019ecc17956a60aa5fbf Mon Sep 17 00:00:00 2001 From: Yandols ZeonX Date: Fri, 12 Apr 2019 01:21:16 +0800 Subject: [PATCH] Finished new working uploader filename randomizer algorithm (abbr. as UFNRA). --- upload.php | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/upload.php b/upload.php index ac7b70f..58e92f1 100644 --- a/upload.php +++ b/upload.php @@ -1,6 +1,6 @@ = '00') && (date('H') <= '05')) { + $hourId = '3'; + } else if ((date('H') >= '06') && (date('H') <= '11')) { + $hourId = 'E'; + } else if ((date('H') >= '12') && (date('H') <= '17')) { + $hourId = 'd'; + } else if ((date('H') >= '18') && (date('H') <= '23')) { + $hourId = 'C'; + } else { + $hourId = 'z'; + } //$newfilename = time() . '_' . rand(1000000, 9999999) . '.' . end(explode(".",$_FILES["fileToUpload"]["name"])); --prior to v0.6b //$newfilename = time() . '_' . rand(100, 999) . '_' . rand(100000000, 999999999) . '.' . end(explode(".",$_FILES["fileToUpload"]["name"])); --prior to v0.8 + //$newfilename = $randomFilename . '.' . end(explode(".",$_FILES["fileToUpload"]["name"])); $newfilename = $randomFilename . '.' . end(explode(".",$_FILES["fileToUpload"]["name"])); $newtarget = $target_dir . $newfilename; - //if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $newtarget)) { chmod("$newtarget", 0775); // Set read and write permissions if file echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";