Script.php: remove unused statements
parent
2255a1a9eb
commit
3ee85d0bda
30
Script.php
30
Script.php
|
@ -1,16 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
include 'NoDirectPhpAcess.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');
|
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";
|
include "get_mysql_credentials.php";
|
||||||
$con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr");
|
$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
|
// Check connection
|
||||||
if (mysqli_connect_errno()) {
|
if (mysqli_connect_errno()) {
|
||||||
echo "Failed to connect to MySQL: " . mysqli_connect_error();
|
echo "Failed to connect to MySQL: " . mysqli_connect_error();
|
||||||
|
@ -298,8 +274,6 @@ if (!empty($_POST["form_createlecturrer"])){
|
||||||
$password = generateStrongPassword();
|
$password = generateStrongPassword();
|
||||||
}
|
}
|
||||||
|
|
||||||
// $passport_no=$password;
|
|
||||||
// check if email is taken
|
|
||||||
$result = mysqli_query(
|
$result = mysqli_query(
|
||||||
$con,
|
$con,
|
||||||
"SELECT * FROM users_table WHERE email='$email'"
|
"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.";
|
$_SESSION["info_Admin_Users"] = "Email address : " . $email . " is already in use.";
|
||||||
header("Location: Admin.php");
|
header("Location: Admin.php");
|
||||||
exit;
|
exit;
|
||||||
// header( "refresh:5;url=Admin.php" );
|
|
||||||
}
|
}
|
||||||
$password_hash = password_hash("$password", PASSWORD_DEFAULT);
|
$password_hash = password_hash("$password", PASSWORD_DEFAULT);
|
||||||
$sql = "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`) VALUES "
|
$sql = "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`) VALUES "
|
||||||
. "('$email','$password_hash','$fullname','$type')";
|
. "('$email','$password_hash','$fullname','$type')";
|
||||||
|
|
||||||
if ($con->query($sql) === TRUE) {
|
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.";
|
$_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");
|
header("Location: Admin.php");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue