From f3ef8d8e5cf32e7800c685e3efc0d347403624d2 Mon Sep 17 00:00:00 2001 From: newtechAI Date: Wed, 6 Dec 2023 02:40:34 +0100 Subject: [PATCH] Fix Bug352 --- Script.php | 62 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 5 deletions(-) diff --git a/Script.php b/Script.php index f664eee..16df7d3 100644 --- a/Script.php +++ b/Script.php @@ -1,7 +1,19 @@ + query($sql) === TRUE) { - $_SESSION["info_Admin_Users"] = $type . " user created successfully. Use email " . $email . " as account name and $password as password."; + // $file_name = $email.'.txt'; + $_SESSION["info_Admin_Users"] = $type . " user created successfully. Use email " . $email . " as account name and ". $password ." as password."; + // file_put_contents('./acounts/'.$file_name, $_SESSION["info_Admin_Users"]); + //downloadFile($email); header("Location: Admin.php"); + } else { - echo "Error: " . $sql . "
" . $con->error; + alert("Error: " . $sql . "
" . $con->error); } + +} + +// ### FUNCTION TO GENERATE INITIAL PASSWORDS ###// +function generateStrongPassword() { + + $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_'; + $password_length = 12; + $gen_password = ''; + for ($i = 0; $i < $password_length; $i++) { + $random_index = mt_rand(0, strlen($characters) - 1); + $gen_password .= $characters[$random_index]; + } + + // Return the generated password + return $gen_password; } // #### FUNCTION CHECK FILE TYPES ////