From 1e8533090fd267b365e503d09ffdb82e1f7c329e Mon Sep 17 00:00:00 2001 From: YAKUBU ABDULAI Date: Thu, 1 Dec 2022 21:41:27 +0800 Subject: [PATCH] Admin.php - Fixed Bug 485 Lecturer should not have the administration panel that allows him to create other Lecturer accounts (#49) Co-authored-by: GaoxingAbdullah Co-authored-by: Hui Lan Reviewed-on: http://121.4.94.30:3000/mrlan/LRR/pulls/49 Co-authored-by: YAKUBU ABDULAI Co-committed-by: YAKUBU ABDULAI --- Admin.php | 80 ++++++++++++++++++++++++++++++++++++-------- NoDirectPhpAcess.php | 2 +- Script.php | 2 +- 3 files changed, 68 insertions(+), 16 deletions(-) diff --git a/Admin.php b/Admin.php index f2cbee2..69e94fd 100644 --- a/Admin.php +++ b/Admin.php @@ -8,10 +8,9 @@ include 'Header.php'; ?> @@ -36,10 +35,23 @@ if ($_SESSION['user_type'] != "Lecturer") {
-->
-

User Account Management

-
- Lecturer / TA Accounts
+ TA Account Management +
" ; + echo "TA Accounts
" ; + } + + else if($_SESSION['user_type'] == "Admin"){ + + echo "

Lecturer Account Management

+
"; + echo "Lecturer Accounts
"; + } + + ?>
@@ -65,7 +77,19 @@ if ($_SESSION['user_type'] != "Lecturer") {

- Create Lecturer/TA Accounts + Create TA Accounts "; + + } + + else if($_SESSION['user_type'] == "Admin"){ + + echo "Create Lecturer Accounts "; + } + + ?>
Full_Name @@ -76,9 +100,25 @@ if ($_SESSION['user_type'] != "Lecturer") { Passport_Number / ID (Used as Intial Password)
User Type : - Lecturer - T/A + + TA (Teaching Assistant) '; + + } + + else if($_SESSION['user_type'] == "Admin"){ + + echo " Lecturer "; + + } + + ?> +
+ Reset"; diff --git a/NoDirectPhpAcess.php b/NoDirectPhpAcess.php index d5e6143..4e85779 100644 --- a/NoDirectPhpAcess.php +++ b/NoDirectPhpAcess.php @@ -2,6 +2,6 @@ // https://stackoverflow.com/questions/33999475/prevent-direct-url-access-to-php-file if (!isset($_SERVER['HTTP_REFERER']) ) { /* choose the appropriate page to redirect users */ - die( header( 'location: index.php' ) ); + die( header( 'location: logout.php' ) ); } ?> diff --git a/Script.php b/Script.php index 7191f4d..224c84f 100644 --- a/Script.php +++ b/Script.php @@ -283,7 +283,7 @@ if (!empty($_POST["frm_createlecturrer"])) { . "('$email','$password','$fullname','$type')"; if ($con->query($sql) === TRUE) { - $_SESSION["info_Admin_Users"] = $type . " user Created successfully : email " . $email . " and $password as Password."; + $_SESSION["info_Admin_Users"] = $type . " user created successfully. Use email " . $email . " as accout name and $password as password."; header("Location: Admin.php"); } else { echo "Error: " . $sql . "
" . $con->error;