diff --git a/Script.php b/Script.php index 32c3ffb..dee89e7 100644 --- a/Script.php +++ b/Script.php @@ -1,16 +1,5 @@ @@ -24,22 +13,9 @@ session_start(); date_default_timezone_set('Asia/Shanghai'); - -//// Connect to MySQL database -//$mysql_host= "localhost"; -//$mysql_username = "root"; -//$mysql_password = ""; -//$mysql_db = "lrr"; -// Connect to MySQL database include "get_mysql_credentials.php"; $con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr"); -// $mysql_username, $mysql_password variable declared directly -// $con= mysqli_connect($mysql_host,$mysql_username,$mysql_password,$mysql_db); -//$con = mysqli_connect("localhost", "root", "", "lrr"); - - - // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); @@ -298,8 +274,6 @@ if (!empty($_POST["form_createlecturrer"])){ $password = generateStrongPassword(); } -// $passport_no=$password; - // check if email is taken $result = mysqli_query( $con, "SELECT * FROM users_table WHERE email='$email'" @@ -308,17 +282,13 @@ if (!empty($_POST["form_createlecturrer"])){ $_SESSION["info_Admin_Users"] = "Email address : " . $email . " is already in use."; header("Location: Admin.php"); exit; - // header( "refresh:5;url=Admin.php" ); } $password_hash = password_hash("$password", PASSWORD_DEFAULT); $sql = "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`) VALUES " . "('$email','$password_hash','$fullname','$type')"; if ($con->query($sql) === TRUE) { - // $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 {