Script.php: remove unused statements

pull/59/head
Lan Hui 2023-12-12 19:22:54 +08:00
parent 2255a1a9eb
commit 3ee85d0bda
1 changed files with 0 additions and 30 deletions

View File

@ -1,16 +1,5 @@
<?php
include 'NoDirectPhpAcess.php';
//function downloadFile($filename)
//{
//
// $file_url = './acounts/' . $filename.'.txt';
// header('content-type: text/plain');
// header('Cache-Control: no-cache, must-revalidate');
// header('Content-Disposition: attachment; filename=' . basename($file_url));
// readfile($file_url);
// header("Refresh: 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 {