forked from mrlan/LRR
Bug510-Abdulai (#51)
- Fixed Bug 510 - Updated with Pull Request 49 (i.e., changes from the branch Bug485-Abdulai). @abdulai Please double check the updated branch Bug510-Abdulai still works. Hui Co-authored-by: GaoxingAbdullah <abduldoobia@yahoo.com> Co-authored-by: Hui Lan <lanhui@zjnu.edu.cn> Reviewed-on: http://121.4.94.30:3000/mrlan/LRR/pulls/51 Co-authored-by: mrlan <mrlan@noreply.121.4.94.30> Co-committed-by: mrlan <mrlan@noreply.121.4.94.30>
parent
1e8533090f
commit
f7f9558721
|
@ -7,6 +7,7 @@ $page = "admin";
|
|||
include 'Header.php';
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
// Only Lecturer or Admin could access this page
|
||||
if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
|
||||
|
@ -14,6 +15,7 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
|
|||
}
|
||||
?>
|
||||
|
||||
|
||||
<style>
|
||||
.col-md-4 {
|
||||
border-right: 1px solid skyblue;
|
||||
|
@ -43,9 +45,7 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
|
|||
<hr> " ;
|
||||
echo "<b>TA Accounts </b><br>" ;
|
||||
}
|
||||
|
||||
else if($_SESSION['user_type'] == "Admin"){
|
||||
|
||||
echo " <h4> Lecturer Account Management </h4>
|
||||
<hr> ";
|
||||
echo "<b>Lecturer Accounts </b><br>";
|
||||
|
@ -83,9 +83,7 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
|
|||
echo "<b>Create TA Accounts </b>";
|
||||
|
||||
}
|
||||
|
||||
else if($_SESSION['user_type'] == "Admin"){
|
||||
|
||||
echo "<b>Create Lecturer Accounts </b>";
|
||||
}
|
||||
|
||||
|
@ -108,7 +106,6 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
|
|||
echo ' <input type="radio" name="type" value="TA" required="" id="role_TA"> TA (Teaching Assistant) ';
|
||||
|
||||
}
|
||||
|
||||
else if($_SESSION['user_type'] == "Admin"){
|
||||
|
||||
echo " <input type='radio' name = 'type' value = 'Lecturer' required = '' id='role_lecturer' > Lecturer ";
|
||||
|
@ -161,7 +158,6 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
|
|||
}
|
||||
|
||||
else if($_SESSION['user_type'] == "Admin"){
|
||||
|
||||
$result = mysqli_query(
|
||||
$con,
|
||||
"SELECT * FROM Users_Table WHERE UserType in ('Lecturer')"
|
||||
|
|
|
@ -279,11 +279,12 @@ if (!empty($_POST["frm_createlecturrer"])) {
|
|||
$_SESSION["info_Admin_Users"]="Email address : ".$email." is already in use.";
|
||||
header("Location: Admin.php");
|
||||
}
|
||||
$password_hash = password_hash("$password", PASSWORD_DEFAULT);
|
||||
$sql= "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`) VALUES "
|
||||
. "('$email','$password','$fullname','$type')";
|
||||
. "('$email','$password_hash','$fullname','$type')";
|
||||
|
||||
if ($con->query($sql) === TRUE) {
|
||||
$_SESSION["info_Admin_Users"] = $type . " user created successfully. Use email " . $email . " as accout name and $password as password.";
|
||||
$_SESSION["info_Admin_Users"] = $type . " user created successfully. Use email " . $email . " as account name and $password as password.";
|
||||
header("Location: Admin.php");
|
||||
} else {
|
||||
echo "Error: " . $sql . "<br>" . $con->error;
|
||||
|
|
Loading…
Reference in New Issue