2020-03-16 15:23:14 +08:00
|
|
|
<?php
|
|
|
|
session_start();
|
|
|
|
error_reporting(0);
|
2020-10-02 17:02:20 +08:00
|
|
|
date_default_timezone_set('Asia/Shanghai');
|
2020-03-16 15:23:14 +08:00
|
|
|
|
2020-10-02 23:02:27 +08:00
|
|
|
include "get_mysql_credentials.php";
|
|
|
|
$con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr");
|
2020-03-16 15:23:14 +08:00
|
|
|
|
2020-10-02 17:02:20 +08:00
|
|
|
// Check database connection
|
|
|
|
if (mysqli_connect_errno()) {
|
2020-03-16 15:23:14 +08:00
|
|
|
echo "Failed to connect to MySQL: " . mysqli_connect_error();
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
|
|
|
<html>
|
2020-10-02 17:02:20 +08:00
|
|
|
|
2021-07-22 22:10:23 +08:00
|
|
|
<head>
|
2021-11-16 22:20:40 +08:00
|
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
|
|
|
<link href="./font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" /><!-- Font-awesome CSS -->
|
|
|
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"><!-- Bootstrap CSS -->
|
2021-07-22 22:10:23 +08:00
|
|
|
|
2021-11-16 22:20:40 +08:00
|
|
|
<link href="./css/styles.css" rel="stylesheet" type="text/css" />
|
2020-03-16 15:23:14 +08:00
|
|
|
|
2021-10-18 23:34:13 +08:00
|
|
|
<script src="./css/jquery.min.js" type="text/javascript"></script>
|
2021-11-16 22:20:40 +08:00
|
|
|
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
|
|
|
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
|
|
|
|
|
2021-10-18 23:34:13 +08:00
|
|
|
<script src="./css/jquery.datetimepicker.min.js" type="text/javascript"></script>
|
2021-11-16 22:20:40 +08:00
|
|
|
<script src="./js/CustomDropdown.js" type="text/javascript"></script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.bd-placeholder-img {
|
|
|
|
font-size: 1.125rem;
|
|
|
|
text-anchor: middle;
|
|
|
|
-webkit-user-select: none;
|
|
|
|
-moz-user-select: none;
|
|
|
|
user-select: none;
|
|
|
|
}
|
2020-03-16 15:23:14 +08:00
|
|
|
|
2021-11-16 22:20:40 +08:00
|
|
|
@media (min-width: 768px) {
|
|
|
|
.bd-placeholder-img-lg {
|
|
|
|
font-size: 3.5rem;
|
2020-03-16 15:23:14 +08:00
|
|
|
}
|
2021-11-16 22:20:40 +08:00
|
|
|
}
|
|
|
|
</style>
|
2021-10-18 23:34:13 +08:00
|
|
|
<script>
|
|
|
|
function updatePass(id) {
|
|
|
|
|
|
|
|
var pass = prompt("Enter your new password : ", "Enter a strong password");
|
|
|
|
|
|
|
|
if (!confirm('Are you sure you want to reset your password?')) {
|
|
|
|
return;
|
2020-03-16 15:23:14 +08:00
|
|
|
}
|
|
|
|
|
2021-10-18 23:34:13 +08:00
|
|
|
window.location.href = "\Script.php\?action=passchange&uid=" + id + "&pass=" + pass;
|
2020-03-16 15:23:14 +08:00
|
|
|
}
|
2021-10-18 23:34:13 +08:00
|
|
|
|
|
|
|
function blockUser(id, status) {
|
|
|
|
if (!confirm('Are you sure you want to change user status?')) {
|
|
|
|
return;
|
2020-03-16 15:23:14 +08:00
|
|
|
}
|
2021-10-18 23:34:13 +08:00
|
|
|
window.location.href = "\Script.php\?action=statuschange&uid=" + id + "&status=" + status;
|
|
|
|
}
|
2021-11-16 22:20:40 +08:00
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
|
|
|
<nav class="navbar navbar-expand-md navbar-dark bg-primary sticky-top">
|
|
|
|
<div class="container-fluid">
|
|
|
|
<a class="navbar-brand" href="~\..\index.php"> <img src="logo.png" width="30" height="30"> LRR </a>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
if (isset($_SESSION["user_fullname"]))
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive">
|
|
|
|
<span class="navbar-toggler-icon"></span>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
<div class="collapse navbar-collapse" id="navbarResponsive">
|
|
|
|
|
|
|
|
<?php
|
|
|
|
if (isset($_SESSION["user_fullname"])) {
|
|
|
|
echo "<ul class=\"navbar-nav mr-auto\">";
|
|
|
|
echo "<li class=\"nav-item active\">";
|
|
|
|
echo "<a class='nav-link' href='~\..\Courses.php'><i class='fa fa-book'></i> Courses</a>";
|
|
|
|
echo "</li></ul>";
|
|
|
|
?>
|
|
|
|
|
|
|
|
<ul class="nav navbar-nav navbar-right">
|
|
|
|
<li class="nav-item">
|
|
|
|
<a class="nav-link text-light" href="#">Welcome <b> <?php echo $_SESSION['user_fullname']; ?> </b>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
$c_date = date("Y-m-d H:i");
|
|
|
|
if (isset($_SESSION['user_student_id']))
|
|
|
|
echo "(" . $_SESSION['user_type'] . " - " . $_SESSION['user_student_id'] . ") ";
|
|
|
|
else
|
|
|
|
echo "(" . $_SESSION['user_type'] . ") ";
|
|
|
|
?>
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="nav-item dropdown">
|
|
|
|
<a class="nav-link dropdown-toggle text-light" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Menu </a>
|
|
|
|
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
|
|
|
<a href="#" class="dropdown-item" onclick="updatePass(<?php echo $_SESSION['user_id']; ?>)"><i class="fa fa-user ">Update passwor</i></a>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
if ($_SESSION['user_type'] == "Lecturer") {
|
|
|
|
echo "<a class=\"dropdown-item\" href=\"~\..\Admin.php\"><i class=\"fa fa-cog\" >Admin</i> </a>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li class="nav-item">
|
|
|
|
<a class="nav-link text-light" href="~\..\logout.php"><i class="fa fa-lock" > Logout</i> </a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</nav>
|