| 
									
										
										
										
											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> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <html> | 
					
						
							| 
									
										
										
										
											2020-10-02 17:02:20 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  |     <head> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-04 18:14:05 +08:00
										 |  |  | 	<title>Lab Report Repository</title> | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 	<link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css" /> | 
					
						
							|  |  |  | 	<link href="./font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" /> | 
					
						
							|  |  |  | 	<!-- *this css file can be used across all the websites  | 
					
						
							|  |  |  | 	     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-07-31 17:10:53 +08:00
										 |  |  | 	<script src="./css/jquery.min.js" type="text/javascript"></script> | 
					
						
							|  |  |  | 	<script src="./css/bootsrap.min.js" type="text/javascript"></script> | 
					
						
							|  |  |  | 	<script src="./css/jquery.datetimepicker.min.js" type="text/javascript"></script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	<style> | 
					
						
							|  |  |  | 	 .nav-item { | 
					
						
							|  |  |  | 	     border-color: #00ff66;
 | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 .nav-tabs { | 
					
						
							|  |  |  | 	     border-color: #00ff66;
 | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 .btn-default { | 
					
						
							| 
									
										
										
										
											2023-08-04 18:26:22 +08:00
										 |  |  | 	     border: 1px solid #e6f2ff;
 | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 	     width: 100%; | 
					
						
							|  |  |  | 	     text-align: left; | 
					
						
							| 
									
										
										
										
											2023-08-04 18:26:22 +08:00
										 |  |  | 	     margin: 2px auto; | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 	     font-weight: bold; | 
					
						
							| 
									
										
										
										
											2023-08-04 18:26:22 +08:00
										 |  |  | 	     font-size: 14pt; | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 .table-bordered { | 
					
						
							|  |  |  | 	     padding: 5px !important; | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 .alert { | 
					
						
							|  |  |  | 	     font-weight: bold; | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 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 | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 #footer{
 | 
					
						
							|  |  |  | 	     position:fixed; | 
					
						
							|  |  |  | 	     bottom:0; | 
					
						
							|  |  |  | 	     left:0; | 
					
						
							|  |  |  | 	     background-color:#03417C;
 | 
					
						
							|  |  |  | 	     color:#FFF;
 | 
					
						
							|  |  |  | 	     text-align:center; | 
					
						
							|  |  |  | 	     width:100%; | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 .txt1 { | 
					
						
							|  |  |  | 	     font-family: Poppins-Regular; | 
					
						
							|  |  |  | 	     font-size: 18px; | 
					
						
							|  |  |  | 	     line-height: 1.5; | 
					
						
							|  |  |  | 	     color: #666666;
 | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	 .txt2 { | 
					
						
							|  |  |  | 	     font-family: Poppins-Regular; | 
					
						
							|  |  |  | 	     font-size: 19px; | 
					
						
							|  |  |  | 	     line-height: 1.5; | 
					
						
							|  |  |  | 	     color: #2471A3;
 | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 	 .col-md-4 { | 
					
						
							|  |  |  | 	     border-right: 1px solid skyblue; | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-31 17:10:53 +08:00
										 |  |  | 	</style> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     </head> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <body> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	<nav class="navbar navbar-expand-lg navbar-dark bg-dark" style="padding-left:150px;padding-right:150px;margin:auto;"> | 
					
						
							|  |  |  | 	    <a class="navbar-brand" href="~\..\index.php"> <img src="logo.png" style="width:30px;height:30px;"> LRR </a> | 
					
						
							|  |  |  | 	    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation"> | 
					
						
							|  |  |  | 		<span class="navbar-toggler-icon"></span> | 
					
						
							|  |  |  | 	    </button> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	    <div class="collapse navbar-collapse" id="navbarColor02"> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		<ul class="navbar-nav mr-auto"> | 
					
						
							|  |  |  | 		    <li class="nav-item active"> | 
					
						
							|  |  |  | 			<?php | 
					
						
							|  |  |  | 			if (isset($_SESSION["user_fullname"])) { | 
					
						
							|  |  |  | 			    echo "       <a class='nav-link' href='~\..\Courses.php'><i class='fa fa-book'></i> Courses <span class='sr-only'>(current)</span></a>"; | 
					
						
							|  |  |  | 			?>
 | 
					
						
							|  |  |  | 		    </li> | 
					
						
							|  |  |  | 		</ul> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		<form class="form-inline my-2 my-lg-0" style="color:#fff;"> | 
					
						
							|  |  |  | 		    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'] . ")   "; | 
					
						
							|  |  |  | 		    ?>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		    <?php | 
					
						
							|  |  |  | 		    if ($_SESSION['user_type'] == "Lecturer") { // Show Admin link
 | 
					
						
							|  |  |  | 			echo "     <i class=\"fa fa-cog\" style=\"color:#fff;\"> </i>"; | 
					
						
							|  |  |  | 			echo " <a style='color:#fff !important' href=\"~\..\Admin.php\" id=\"admin_tab\">Admin</a>"; | 
					
						
							|  |  |  | 		    } | 
					
						
							|  |  |  | 		    ?>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		        <i class="fa fa-user" style="color:#fff;"> </i> | 
					
						
							|  |  |  | 		     <a href="#" style='color:#fff !important' onclick="updatePass(<?php echo $_SESSION['user_id']; ?>)">Update password</a> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		        <i class="fa fa-lock" style="color:#fff;"> </i> | 
					
						
							|  |  |  | 		     <a style='color:#fff !important' href="~\..\logout.php">Logout </a> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			<?php | 
					
						
							|  |  |  | 			}  // Confusing.  What is this for?
 | 
					
						
							|  |  |  | 			?>
 | 
					
						
							|  |  |  | 		</form> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	    </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; | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 	</script> |