| 
									
										
										
										
											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()) { | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  |     echo "Failed to connect to MySQL: " . mysqli_connect_error(); | 
					
						
							| 
									
										
										
										
											2020-03-16 15:23:14 +08:00
										 |  |  | } | 
					
						
							|  |  |  | ?>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!DOCTYPE html> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-06 17:43:36 +08:00
										 |  |  | <html lang="en-US"> | 
					
						
							| 
									
										
										
										
											2020-10-02 17:02:20 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  |     <head> | 
					
						
							| 
									
										
										
										
											2023-08-07 16:39:19 +08:00
										 |  |  | 	<meta charset="utf-8"> | 
					
						
							| 
									
										
										
										
											2023-08-06 17:43:36 +08:00
										 |  |  | 	<meta name="viewport" content="width=device-width, initial-scale=1"> | 
					
						
							| 
									
										
										
										
											2023-08-11 21:45:22 +08:00
										 |  |  | 	<title>LRR</title> | 
					
						
							| 
									
										
										
										
											2023-08-07 16:39:19 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous"> | 
					
						
							|  |  |  | 	<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 	<link href="./font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" /> | 
					
						
							| 
									
										
										
										
											2023-08-06 17:43:36 +08:00
										 |  |  | 	<!-- *this css file can be used across all the websites | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 	     and any new css class can be added there. | 
					
						
							|  |  |  | 	     * The reason is to make the css code reusable. | 
					
						
							|  |  |  | 	     * the css file is used by submissions.php | 
					
						
							|  |  |  | 	--> | 
					
						
							| 
									
										
										
										
											2023-08-02 14:57:08 +08:00
										 |  |  | 	<link href = "./css/main.css" rel="stylesheet" type="text/css" /> | 
					
						
							| 
									
										
										
										
											2023-08-12 20:56:27 +08:00
										 |  |  | 	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 	<script src="./css/jquery.datetimepicker.min.js" type="text/javascript"></script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	<style> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 .btn-default { | 
					
						
							| 
									
										
										
										
											2023-08-13 21:30:56 +08:00
										 |  |  | 	     border: 2px solid #f8f8f8;
 | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 	     width: 100%; | 
					
						
							|  |  |  | 	     text-align: left; | 
					
						
							| 
									
										
										
										
											2023-08-13 21:30:56 +08:00
										 |  |  | 	     margin: 4px auto; | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |          .btn-default:hover { | 
					
						
							|  |  |  |              background: #f8f8f8;
 | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 h1, | 
					
						
							|  |  |  | 	 h2, | 
					
						
							|  |  |  | 	 h3, | 
					
						
							|  |  |  | 	 h4 { | 
					
						
							|  |  |  | 	     color: #03407B;
 | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 a { | 
					
						
							|  |  |  | 	     color: #03407B;
 | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 .break-word { | 
					
						
							|  |  |  | 	     word-wrap: break-word; | 
					
						
							|  |  |  | 	     white-space: -moz-pre-wrap !important; | 
					
						
							|  |  |  | 	     /* Mozilla, since 1999 */ | 
					
						
							|  |  |  | 	     white-space: -pre-wrap; | 
					
						
							|  |  |  | 	     /* Opera 4-6 */ | 
					
						
							|  |  |  | 	     white-space: -o-pre-wrap; | 
					
						
							|  |  |  | 	     /* Opera 7 */ | 
					
						
							|  |  |  | 	     white-space: pre-wrap; | 
					
						
							|  |  |  | 	     /* css-3 */ | 
					
						
							|  |  |  | 	     word-wrap: break-word; | 
					
						
							|  |  |  | 	     /* Internet Explorer 5.5+ */ | 
					
						
							|  |  |  | 	     white-space: -webkit-pre-wrap; | 
					
						
							|  |  |  | 	     /* Newer versions of Chrome/Safari*/ | 
					
						
							|  |  |  | 	     word-break: break-all; | 
					
						
							|  |  |  | 	     white-space: normal; | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 .ui-widget-content.ui-dialog { | 
					
						
							|  |  |  | 	     border: 2px solid #03488B;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 .ui-dialog>.ui-widget-header { | 
					
						
							|  |  |  | 	     background: #03488B;
 | 
					
						
							|  |  |  | 	     color: white | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 .ui-button { | 
					
						
							|  |  |  | 	     background: #03488B;
 | 
					
						
							|  |  |  | 	     color: white | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-12 21:25:16 +08:00
										 |  |  |     .ui-dialog-titlebar-close::before { | 
					
						
							|  |  |  |         content: "X"; | 
					
						
							|  |  |  |         position: absolute; | 
					
						
							|  |  |  |         top: 1px; | 
					
						
							|  |  |  |         left: 3px; | 
					
						
							|  |  |  |         line-height: 1rem; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 	 #footer{
 | 
					
						
							|  |  |  | 	     position:fixed; | 
					
						
							|  |  |  | 	     bottom:0; | 
					
						
							|  |  |  | 	     left:0; | 
					
						
							|  |  |  | 	     text-align:center; | 
					
						
							|  |  |  | 	     width:100%; | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-31 17:13:36 +08:00
										 |  |  | 	 .form-control{ | 
					
						
							|  |  |  | 	     padding-top: 1px; | 
					
						
							|  |  |  | 	     padding-bottom:1px; | 
					
						
							|  |  |  | 	 } | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-01 17:02:33 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 	</style> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     </head> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <body> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 16:39:19 +08:00
										 |  |  | 	<nav class="navbar navbar-expand-lg bg-body-tertiary" style="padding-left:180px;padding-right:150px;margin:auto;"> | 
					
						
							|  |  |  | 	    <div class="container-fluid"> | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 16:39:19 +08:00
										 |  |  | 		<a class="navbar-brand" href="~\..\index.php"> <img src="logo.png" style="width:30px;height:30px;" alt="LRR Logo"> LRR </a> | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 16:39:19 +08:00
										 |  |  | 		<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> | 
					
						
							|  |  |  | 		    <span class="navbar-toggler-icon"></span> | 
					
						
							|  |  |  | 		</button> | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 16:39:19 +08:00
										 |  |  | 		<div class="collapse navbar-collapse" id="navbarNavAltMarkup"> | 
					
						
							|  |  |  | 		    <div class="navbar-nav"> | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 16:39:19 +08:00
										 |  |  | 			<a class="nav-link" href="#"> | 
					
						
							|  |  |  | 			    <?php | 
					
						
							|  |  |  | 			    if (isset($_SESSION["user_fullname"])) { | 
					
						
							|  |  |  | 				echo $_SESSION['user_fullname']; | 
					
						
							|  |  |  | 			    } | 
					
						
							|  |  |  | 			    ?>
 | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 16:39:19 +08:00
										 |  |  | 			      | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 16:39:19 +08:00
										 |  |  | 			    <?php | 
					
						
							|  |  |  | 			    $c_date =  date("Y-m-d H:i"); | 
					
						
							|  |  |  | 			    if (isset($_SESSION['user_student_id'])) | 
					
						
							|  |  |  | 				echo "(" . $_SESSION['user_type'] . " - " . $_SESSION['user_student_id'] . ")   "; | 
					
						
							|  |  |  | 			    elseif (isset($_SESSION['user_type'])) | 
					
						
							|  |  |  | 				echo "(" . $_SESSION['user_type'] . ")   "; | 
					
						
							|  |  |  | 			    ?>
 | 
					
						
							|  |  |  | 			</a> | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 16:39:19 +08:00
										 |  |  | 			<?php | 
					
						
							|  |  |  | 			if (isset($_SESSION["user_fullname"])) { | 
					
						
							|  |  |  | 			    echo "<a class='nav-link' href='~\..\Courses.php'><i class='fa fa-book'></i> My courses </a>"; | 
					
						
							|  |  |  | 			?>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			<?php | 
					
						
							|  |  |  | 			    if ($_SESSION['user_type'] == "Lecturer") { // Show Admin link
 | 
					
						
							|  |  |  | 			        echo "    <a class='nav-link' href=\"~\..\Admin.php\" id=\"admin_tab\"><i class='fa fa-cog'></i>Admin</a>"; | 
					
						
							|  |  |  | 			    } | 
					
						
							|  |  |  | 			?>
 | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 16:39:19 +08:00
										 |  |  | 			         | 
					
						
							|  |  |  | 			    <a class="nav-link" href="#" onclick="updatePass(<?php echo $_SESSION['user_id']; ?>)"><i class="fa fa-user"> </i> Update password</a> | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 16:39:19 +08:00
										 |  |  | 			         | 
					
						
							|  |  |  | 			    <a class="nav-link" href="~\..\logout.php"><i class="fa fa-lock"> </i> Logout</a> | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			<?php | 
					
						
							| 
									
										
										
										
											2023-08-07 16:39:19 +08:00
										 |  |  | 			}  // Closing this conditional test block: if (isset($_SESSION["user_fullname"])) { ...
 | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 			?>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 16:39:19 +08:00
										 |  |  | 		    </div> | 
					
						
							|  |  |  | 		</div> | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 	    </div> | 
					
						
							|  |  |  | 	</nav> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	<script> | 
					
						
							|  |  |  | 	 function updatePass(id) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	     const pass = prompt("Enter your new password : ", "Enter a strong password"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	     if (!confirm('Are you sure you want to reset your password?')) { | 
					
						
							|  |  |  | 		 return; | 
					
						
							|  |  |  | 	     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	     window.location.href = "\Script.php\?action=passchange&uid=" + id + "&pass=" + pass; | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 function blockUser(id, status) { | 
					
						
							|  |  |  | 	     if (!confirm('Are you sure you want to change user status?')) { | 
					
						
							|  |  |  | 		 return; | 
					
						
							|  |  |  | 	     } | 
					
						
							|  |  |  | 	     window.location.href = "\Script.php\?action=statuschange&uid=" + id + "&status=" + status; | 
					
						
							|  |  |  | 	 } | 
					
						
							| 
									
										
										
										
											2023-08-08 15:02:26 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 	</script> |