Bug430-Eden2 #62

Closed
eden wants to merge 151 commits from Bug430-Eden2 into master
34 changed files with 2224 additions and 3870 deletions

BIN
.DS_Store vendored

Binary file not shown.

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
.vscode
.DS_Store

208
Admin.php
View File

@ -15,109 +15,76 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
}
?>
<style>
.col-md-4 {
border-right: 1px solid skyblue;
}
</style>
<br>
<div style="width: 80%;margin: auto;">
<h2> Administration Panel </h2>
</div>
<hr>
<div class="row" style="width: 80%;margin: auto;">
<!--<h4>General system Settings</h4><hr>
<a href="" class="btn btn-lg btn-primary">View System Log </a>
<hr>
Lab Privacy Mode: (STUDENT VERIFICATION)
<hr>
-->
<div class="col-md-6">
<?php
if ($_SESSION['user_type'] == "Lecturer") {
echo " <h4> TA Account Management </h4>
<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>";
}
?>
<div class="container">
<br>
<h1 class="display-6"> Administration panel </h1>
<hr>
<div class="row">
<div class="col-md-6">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<ul class="nav nav-tabs" id="myTab">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#home">Create New Account</a>
<a class="nav-link active" href="#tab-student-accounts" id="batch_tab">Create student accounts</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu2" id="batch_tab">Batch Create New Student Accounts</a>
<a class="nav-link" href="#tab-ins-accounts">Create instructor account</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu1" id="existing_accounts_tab">Existing Accounts</a>
<a class="nav-link" href="#tab-existing-accounts" id="existing_accounts_tab">Existing accounts</a>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div id="home" class="container tab-pane active"><br>
<!-- code contributed by Xu Xiaopeng (https://github.com/xxp1999) -->
<div id="tab-student-accounts" class="tab-pane active" style="margin-top:5px">
<p class="text-muted">Copy & paste student number to the following box, and separate two student numbers with a space.</p>
<form action="batch_insert.php" method="post" id="batch_form">
<textarea cols="60" rows="16" name="users" required=""></textarea>
<button type="submit" class="btn btn-primary" id="register_btn">Register students</button>
</form>
</div>
<div id="tab-ins-accounts" class="tab-pane"><br>
<?php
if ($_SESSION['user_type'] == "Lecturer") {
echo "<b>Create TA Accounts </b>";
echo "<p class=\"text-muted\">Create TA Accounts</p>";
}
else if($_SESSION['user_type'] == "Admin"){
echo "<b>Create Lecturer Accounts </b>";
echo "<p class=\"text-muted\">Create Lecturer Accounts</p>";
}
?>
<form method="post" action="Script.php" id="create_account_form">
<input type="hidden" name="frm_createlecturrer" value="true" required="" />
Full Name
<input type="text" name="fullname" placeholder="Full Name" class="form-control" required="">
<input type="hidden" name="form_createlecturrer" value="true" required="" />
Full name
<input type="text" name="fullname" placeholder="Full Name" class="form-control" required=""> <br>
Email
<input type="text" name="email" placeholder="Email / Student Number" class="form-control" required="">
Passport Number / ID (Used as Initial Password)
<input type="text" class="form-control" name="passport" placeholder="Passport No./ID" required="">
<br> User Type :
<input type="text" name="email" placeholder="Email / Student Number" class="form-control" required=""> <br>
Passport No. (used as the initial password)
<input type="text" class="form-control" name="passport" placeholder="Passport No" required=""> <br>
User type:
<?php
if ($_SESSION['user_type'] == "Lecturer") {
echo ' <input type="radio" name="type" value="TA" required="" id="role_TA"> TA (Teaching Assistant) ';
}
else if($_SESSION['user_type'] == "Admin"){
} else if ($_SESSION['user_type'] == "Admin"){
echo " <input type='radio' name='type' value='Lecturer' required='' id='role_lecturer'> Lecturer ";
}
?>
<input type="submit" class="btn btn-primary" value="Create" id="create_btn"><br>
<br><br>
<button type="submit" class="btn btn-primary" id="create_btn">Create</button>
<?php
error_reporting(E_ALL);
if (isset($_SESSION['info_Admin_Users'])) {
echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Users'] . '</div>';
@ -127,24 +94,22 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Users'] . '</div>';
$_SESSION['info_Admin_Users'] = null;
}
?>
</form>
<hr>
</div>
<div id="menu1" class="container tab-pane fade"><br>
<table class="table-bordered" style="font-size: 10pt;">
<div id="tab-existing-accounts" class="tab-pane"><br>
<table class="table" style="font-size: 10pt;">
<tr style="font-size:10pt;">
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Passport / ID </th>
<th>Reset Password </th>
<th>Reset password </th>
<th>Block/Activate </th>
</tr>
<?php
@ -153,83 +118,67 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
$result = mysqli_query(
$con,
"SELECT * FROM Users_Table WHERE UserType in ('TA')"
"SELECT * FROM users_table WHERE UserType in ('TA')"
);
}
else if ($_SESSION['user_type'] == "Admin"){
$result = mysqli_query(
$con,
"SELECT * FROM Users_Table WHERE UserType in ('Lecturer')"
"SELECT * FROM users_table WHERE UserType in ('Lecturer')"
);
}
while ($row = mysqli_fetch_assoc($result)) {
$pass = $row['Passport_Number'];
$btn = "<button class='btn-primary' onclick=\"updatePass(" . $row['User_ID'] . ",'$pass')\">Reset</button>";
$btn = "<button class='btn btn-warning' onclick=\"updatePassword(" . $row['User_ID'] . ",'$pass')\">Reset</button>";
if ($row['Status'] == "Active") {
$newstatus = "Blocked";
$btnBlock = "<button class='btn-danger' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"block_account_1\">Block</button>";
$btnBlock = "<button class='btn btn-danger' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"block_account_1\">Block</button>";
} else {
$newstatus = "Active";
$btnBlock = "<button class='btn-success' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"activate_account_1\">Activate</button>";
$btnBlock = "<button class='btn btn-success' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"activate_account_1\">Activate</button>";
}
echo "<tr><td>" . $row['User_ID'] . "</td><td>" . $row['Full_Name'] . "</td><td>" . $row['Email'] . "</td> <td>" . $row['Passport_Number'] . "</td><td>$btn</td><td>$btnBlock</td></tr>";
}
?>
</table>
</div>
<!-- code contributed by Xu Xiaopeng (https://github.com/xxp1999) -->
<div id="menu2" class="container tab-pane fade" style="margin-top:10px">
<b>Separate two student numbers with a space.</b><br>
<form action="batch_insert.php" method="post" id="batch_form">
<p>
<textarea cols="80" rows="16" name="users" required=""></textarea>
</p>
<input type="submit" class="btn btn-primary" value="Register Students" id="register_btn"><br>
</form>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="container">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<ul class="nav nav-tabs" id="myTab">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#menub" id="existing_courses">Existing Courses</a>
<a class="nav-link active" href="#tab-existing-courses" id="existing_courses">Existing courses</a>
</li>
</ul>
<!-- Tab panes -->
<div id="tab-existing-courses" class="tab-pane active"><br>
</div>
<p class="text-muted"> Past courses </p>
<div id="menub" class="container tab-pane active"><br>
<b> Existing Course Portals </b>
<hr>
<table class="table-bordered" style="font-size: 10pt;">
<table class="table" style="font-size: 10pt;">
<tr>
<th>Course Name </th>
<th>Course name</th>
<th>Faculty</th>
<th>Lecturer</th>
<th>TAs</th>
<th>Assign new TA </th>
<th>Assign a new TA </th>
</tr>
<?php
$result = mysqli_query($con, "SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` , users_table.Full_Name FROM `courses_table` INNER JOIN users_table ON users_table.User_ID=courses_table.Lecturer_User_ID");
if (mysqli_num_rows($result) == 0) {
} else {
$user_id = $_SESSION['user_id'];
if ($_SESSION['user_type'] == 'Lecturer') {
$result = mysqli_query($con, "SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`, `TA_User_ID`, `Course_Code`, `Full_Name` FROM courses_table INNER JOIN users_table ON users_table.User_ID=courses_table.Lecturer_User_ID WHERE User_ID=$user_id ORDER BY Academic_Year DESC;");
} else if ($_SESSION['user_type'] == 'Admin') {
$result = mysqli_query($con, "SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`, `TA_User_ID`, `Course_Code`, `Full_Name` FROM courses_table INNER JOIN users_table ON users_table.User_ID=courses_table.Lecturer_User_ID ORDER BY Academic_Year DESC;");
}
if (mysqli_num_rows($result) != 0) {
$counter = 0;
while ($row = mysqli_fetch_assoc($result)) {
$name = $row['Course_Name'];
@ -240,19 +189,17 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
$c_id = $row['Course_ID'];
$counter += 1;
$resultTA = mysqli_query($con, "SELECT `Course_ID`, `TA`,users_table.Full_Name as TA_NAME FROM `course_ta`
INNER JOIN users_table on users_table.User_ID=course_ta.TA
where course_ta.Course_ID=$c_id");
$resultTA = mysqli_query($con, "SELECT `Course_ID`, `TA`, users_table.Full_Name as TA_NAME FROM course_ta INNER JOIN users_table on users_table.User_ID=course_ta.TA where course_ta.Course_ID=$c_id");
$ta = "";
while ($rowTA = mysqli_fetch_assoc($resultTA)) {
$ta = $ta . " - " . $rowTA['TA_NAME'];
$ta = $ta . " " . $rowTA['TA_NAME'];
}
echo "
<tr> <td>$code - $name</td> <td>$faculty </td> <td>$lecturer</td><td>$ta</td> <td><form method='get' action='Script.php' id='drop_menu_form_$counter'> <select name='ta' class=''>";
$resultx = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='TA'");
$resultx = mysqli_query($con, "SELECT * FROM users_table WHERE UserType='TA'");
if (mysqli_num_rows($resultx) == 0) {
} else {
while ($row = mysqli_fetch_assoc($resultx)) {
@ -262,10 +209,11 @@ where course_ta.Course_ID=$c_id");
}
}
echo "</select> <input type='hidden' name='assignTA' value='true'> <input type='hidden' name='id' value='$c_id'> <input type='submit' value='assign' id='assign_btn_$counter'></form> </td></tr>
echo "</select> <input type='hidden' name='assignTA' value='true'> <input type='hidden' name='id' value='$c_id'> <button class='btn btn-outline-secondary btn-sm' type='submit' id='assign_btn_$counter'>assign</button></form> </td></tr>
";
}
} ?>
}
?>
</table>
@ -275,9 +223,13 @@ where course_ta.Course_ID=$c_id");
</div>
</div>
<?php include 'Footer.php';?>
<script>
function updatePass(id, pass) {
if (!confirm('Are you to Reset User Password')) {
function updatePassword(id, pass) {
if (!confirm('Are you sure to reset user password?')) {
return;
}
@ -285,9 +237,25 @@ where course_ta.Course_ID=$c_id");
}
function blockUser(id, status) {
if (!confirm('Are you to change User Status')) {
if (!confirm('Are you sure to change user status?')) {
return;
}
window.location.href = "\Script.php\?action=statuschange&uid=" + id + "&status=" + status;
}
/* For tabs to work */
const triggerTabList = document.querySelectorAll('#myTab a')
triggerTabList.forEach(triggerEl => {
const tabTrigger = new bootstrap.Tab(triggerEl)
triggerEl.addEventListener('click', event => {
event.preventDefault()
tabTrigger.show()
})
})
</script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -4,83 +4,77 @@ include 'NoDirectPhpAcess.php';
<?php
$page='Courses';
include 'Header.php';
?>
$user_d = $_SESSION['user_id'];
<div class="container">
<?php
$user_id = $_SESSION['user_id'];
if( $_SESSION['user_type']=="Lecturer" || $_SESSION['user_type']=="TA")
{
?>
<!-- FOR LECTURER-->
<div class="row" style="width:80%;margin:auto; text-align:left;">
<script src="./css/jquery-1.11.1.min.js"></script>
<script src="./css/jquery-ui.min.js"></script>
<link rel="stylesheet" href="./css/jquery-ui.css" />
<div class="row">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/themes/base/jquery-ui.min.css" integrity="sha512-ELV+xyi8IhEApPS/pSj66+Jiw+sOT1Mqkzlh8ExXihe4zfqbWkxPRi8wptXIO9g73FSlhmquFlUOuMSoXz5IRw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<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>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min.js" integrity="sha512-57oZ/vW8ANMjR/KQ6Be9v/+/h6bq9/l3f0Oc7vn6qMqyhvPd1cvKBRWWpzu0QoneImqr2SkmO4MSqU+RpHom3Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
function extend_deadline(id) {
var dropstudents=$("#dropstudents").html();
try
{
$('<form id="frm" method="get" action="Script.php">\n\
<input type="hidden" name="extenddeadline" value="true" >\n\
<input type="hidden" name="id" value="'+id+'" > \n\
New Date/Time <br><input type="date" name="date" required=""> <input type="time" name="time" required=""> \n\
\n\
<br><input type="radio" value="1" name="type" required=""> Extend for All<hr> \n\
<input type="radio" value="2" name="type" required=""> Extend for these Individual Students \n\
'+dropstudents+' \n\
</form>').dialog({
function extendDeadline(id) {
const dropstudents = $("#dropstudents").html();
try {
$(`<form id="frm" method="get" action="Script.php">
<input type="hidden" name="extenddeadline" value="true" >
<input type="hidden" name="id" value="${id}" >
New date and time<br>
<input type="date" name="date" required="">
<input type="time" name="time" required="">
<br>
<input type="radio" value="1" name="type" required=""> Extend for all
<br>
<input type="radio" value="2" name="type" required=""> Extend for one
<br>
${dropstudents}
</form>`).dialog({
modal: true,
title:'Extend Deadline',
title:'Extend deadline',
close: function () {
var closeBtn = $('.ui-dialog-titlebar-close');
closeBtn.html('');
},
buttons: {
'Submit': function () {
$('#frm').submit();
$(this).dialog('close');
},
'X': function () {
'Cancel': function () {
$(this).dialog('close');
}
}
});
}catch(e){ alert(e); }
} catch(e) {
alert(e);
}
}
</script>
<?php
if(!empty($_GET["course"]))
{
if (!empty($_GET["course"])) {
$course_url = mysqli_real_escape_string($con, $_GET["course"]);
$result = mysqli_query($con,"SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`,"
. " `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` "
. " , users_table.Full_Name FROM `courses_table` INNER JOIN users_table"
. " ON users_table.User_ID=courses_table.Lecturer_User_ID where URL='$course_url' ");
$result = mysqli_query($con,"SELECT Course_ID, Course_Name, Academic_Year, Faculty, Lecturer_User_ID, TA_User_ID, Course_Code, URL, Verify_New_Members, users_table.Full_Name
FROM courses_table
INNER JOIN users_table
ON users_table.User_ID=courses_table.Lecturer_User_ID
WHERE URL='$course_url' ");
if(mysqli_num_rows($result)==0)
{} else { while($row = mysqli_fetch_assoc($result)) {
if(mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$name = $row['Course_Name'];
$code = $row['Course_Code'];
$faculty = $row['Faculty'];
@ -89,15 +83,11 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
$url = $row['URL'];
$id = $row['Course_ID'];
$course_id = $row['Course_ID'];
echo "
<div class='alert> <a href='~\..\Courses.php?course=$url'> <div class='panel'>
($code) - $name
<br> <span style='font-size:8pt'>Faculty: $faculty | Year: $academic | Lecturer: $lecturer </span>
</div></a>
<hr></div></div> <div class='row' style='width:80%;margin:auto; text-align:left;'>
";
echo "<p class='mt-md-1 mb-md-1'> <strong>($code) - $name</strong> </p>
<br>
<small> Faculty: $faculty &nbsp;&nbsp; Year: $academic &nbsp;&nbsp; Lecturer: $lecturer </small>
<hr>
<div class='row'>";
echo "<div class='col-md-5'>";
}
@ -107,7 +97,6 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
if ($_GET['act'] == "edit") {
$getid = mysqli_real_escape_string($con, $_GET["cid"]);
$result1 = mysqli_query($con, "SELECT * from lab_reports_table WHERE Lab_Report_ID = '$getid'");
while($row1 = mysqli_fetch_assoc($result1)) {
$Deadline = $row1['Deadline'];
$_SESSION['Date'] = trim( strstr($Deadline, ' ', true) );
@ -118,7 +107,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
$_SESSION['Type'] = $row1['Type'];
}
if(isset($_POST['frm_uploadlab'])){
if (isset($_POST['form_uploadlab'])) {
$deadlinedate = trim(mysqli_real_escape_string($con, $_POST["deadlinedate"])); // remove spaces
$deadlinetime = trim(mysqli_real_escape_string($con, $_POST["deadlinetime"])); // remove spaces
$instructions = mysqli_real_escape_string($con, $_POST["instructions"]);
@ -131,13 +120,21 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
$sql = "UPDATE `lab_reports_table` SET `Deadline` = ('" . $Deadline . "'), `Instructions` = ('" . $instructions . "'), `Title` = ('" . $title . "'), `Marks` = ('" . $marks . "'), `Type` = ('" . $type . "') WHERE `lab_reports_table`.`Lab_Report_ID` = '$getid'";
if ($con->query($sql) === TRUE) {
$_SESSION["info_Updated"]="Assignment information updated successfully.";
} else {
// echo "Error: " . $sql . "<br>" . $con->error;
echo "Serious error happened whiling updating assignment information.";
echo "Serious error happened while updating assignment information.";
}
}
if (isset($_POST['form_deletelab'])) {
$sql = "DELETE FROM lab_reports_table WHERE Lab_Report_ID='$getid'";
if ($con->query($sql) === TRUE) {
$_SESSION["info_Updated"]="Assignment deleted successfully.";
} else {
echo "Serious error happened while deleting the assignment.";
}
}
if ($_SESSION['user_type'] == "Lecturer") {
$Date = $_SESSION['Date'];
$Time = $_SESSION['Time'];
@ -145,11 +142,10 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
$Title = $_SESSION['Title'];
$Marks = $_SESSION['Marks'];
$Type = $_SESSION['Type'];
echo " <h3><a href='Courses.php?course=".$url."'> Editing Lab Assignment </a></h3>";
echo "<h3><a href='Courses.php?course=".$url."'>Edit assignment information</a></h3>";
?>
<form method='post' enctype='multipart/form-data' action=''>
<input type='hidden' name='frm_uploadlab' value='true' required=''/>
<input type='hidden' name='form_uploadlab' value='true' required=''/>
<input type='hidden' name='course_id' value='<?php echo "$id" ?>' required=''/>
<input type='hidden' name='url' value='<?php echo ".$course_url." ?>' required=''/>
@ -167,18 +163,13 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
<input type='text' name='marks' placeholder='Marks' class='form-control' required='' value="<?php echo isset($_GET['act']) && $_GET['act']=="edit" ? $Marks : ""; ?>">
Attachment 1
<input type='file' name='attachment1' placeholder='Attachment 1' class='form-control'>
Attachment 2
<input type='file' name='attachment2' placeholder='Attachment 1' class='form-control'>
Attachment 3
<input type='file' name='attachment3' placeholder='Attachment 1' class='form-control' >
Attachment 4
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' >
<br>
<?php
if ($Type == "Individual") {
echo "Submission Type <input type='radio' name='type' value='Individual' checked /> Individual <input type='radio' name='type' value='Group' /> Group";
@ -186,13 +177,17 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
echo "Submission Type <input type='radio' name='type' value='Individual' /> Individual <input type='radio' name='type' value='Group' checked> Group";
}
?>
<hr>
<input type='submit' class='btn btn-primary' value='Post Lab Assignment'><br>
<br>
<input type='submit' class='btn btn-primary' value='Update assignment'><br>
</form><br><br><br><br>
<form method='post' action=''>
<input type='hidden' name='form_deletelab' value='true' required=''/>
<input type='submit' class='btn btn-danger' value='Delete assignment'><br>
</form>
<?php
}}else{
}
} else {
// ------------------------------Posting New Lab Assignment------------------------------------
@ -200,20 +195,19 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
// SELECT SUBSTRING_INDEX(Deadline, ' ', 1) as Date, SUBSTRING_INDEX(Deadline, ' ', -1) as Time from lab_reports_table
if ($_SESSION['user_type'] == "Lecturer") {
?>
<h3> Post new Lab Assignment </a></h3>
<h3>New assignment</h3>
<form method='post' enctype='multipart/form-data' action='Script.php'>
<?php
$_SESSION['url'] = $url;
?>
<input type='hidden' name='frm_uploadlab' value='true' required=''/>
<input type='hidden' name='form_uploadlab' value='true' required=''/>
<input type='hidden' name='course_id' value='<?php echo "$id" ?>' required=''/>
<input type='hidden' name='url' value='<?php echo ".$course_url." ?>' required=''/>
Deadline Date/Time
Deadline (date and time)
<div class='row'>
<div class='col-md-7'><input type='date' id='date' name='deadlinedate' placeholder='' class='form-control' required='' value=""> </div>
<div class='col-md-5'> <input type='time' class='form-control' name='deadlinetime' value=""> </div>
@ -221,28 +215,24 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
Title
<input type='text' name='title' placeholder='Title' class='form-control' required='' value="">
Instructions
Instruction
<textarea name='instructions' placeholder='Assignment Instructions' class='form-control' required='' value=""></textarea>
Marks
Mark
<input type='text' name='marks' placeholder='Marks' class='form-control' required='' value="">
Attachment 1
<input type='file' name='attachment1' placeholder='Attachment 1' class='form-control'>
Attachment 2
<input type='file' name='attachment2' placeholder='Attachment 1' class='form-control'>
Attachment 3
<input type='file' name='attachment3' placeholder='Attachment 1' class='form-control' >
Attachment 4
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' >
<br>
Submission Type <input type='radio' name='type' value='Individual' required=''> Individual
Submission type: <input type='radio' name='type' value='Individual' required=''> Individual
<input type='radio' name='type' value='Group' required=''> Group
<hr>
<input type='submit' class='btn btn-primary' value='Post Lab Assignment'><br>
<input type='submit' class='btn btn-primary' value='Post'><br>
</form><br><br><br><br>
<?php
}
@ -250,39 +240,33 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
}
echo "</div>";
echo "<div class='col-md-7'> <h3> Lab Report Assignment list </h3>";
echo "<div class='col-md-7'><h3>Assignment list</h3>";
error_reporting(0);
if (isset($_SESSION["info_Updated"])) {
echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Updated'] . '</div>';
echo '<hr><div class="alert alert-warning" role="alert">' . $_SESSION['info_Updated'] . '</div>';
$_SESSION['info_Updated'] = null;
}
if (isset($_SESSION['info_courses'])) {
echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_courses'] . '</div>';
echo '<hr><div class="alert alert-warning" role="alert">' . $_SESSION['info_courses'] . '</div>';
$_SESSION['info_courses'] = null;
}
if (isset($_SESSION['info_courses'])) {
echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_courses'] . '</div>';
echo '<hr><div class="alert alert-warning" role="alert">' . $_SESSION['info_courses'] . '</div>';
$_SESSION['info_courses']=null;
}
$result = mysqli_query($con," SELECT `Lab_Report_ID`,Type,Marks, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, `Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, "
. "`Attachment_link_4` FROM `lab_reports_table` WHERE Course_ID=$id ORDER by Lab_Report_ID DESC");
if( $_SESSION['user_type']=="TA")
{
echo "<b style='color:gray'>*Only Lecturer can post a new lab report assignment</b><br>";
if( $_SESSION['user_type'] == "TA") {
echo "<b style='color:gray'>Only Lecturer can post assignments.</b><br>";
}
if(mysqli_num_rows($result)==0)
{
echo "No assignments posted so far.";
} else { while($row = mysqli_fetch_assoc($result)) {
$result = mysqli_query($con, "SELECT Lab_Report_ID, Type, Marks, Course_ID, Posted_Date, Deadline, Instructions, Title, Attachment_link_1, Attachment_link_2, Attachment_link_3, Attachment_link_4
FROM lab_reports_table
WHERE Course_ID=$id ORDER BY Lab_Report_ID DESC");
if(mysqli_num_rows($result)==0) {
echo "No assignments posted so far.";
} else {
while ($row = mysqli_fetch_assoc($result)) {
$marks = $row['Marks'];
$title = $row['Title'];
$ins = $row['Instructions'];
@ -295,73 +279,66 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
$id = $row['Lab_Report_ID'];
$cours_id = $row['Course_ID'];
$as_type = $row['Type'];
$full_link="<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>";
$full_link = "<a href='~\..\Download.php?file=$att1'>$att1</a>";
if ($att2 != "") {
$full_link= $full_link." &nbsp|&nbsp <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>";
$full_link = $full_link." &nbsp|&nbsp <a href='~\..\Download.php?file=$att2'>$att2</a>";
}
if ($att3 != "") {
$full_link= $full_link." &nbsp|&nbsp <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>";
$full_link = $full_link." &nbsp|&nbsp <a href='~\..\Download.php?file=$att3'>$att3</a>";
}
if ($att4 != "") {
$full_link= $full_link." &nbsp; | &nbsp <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>";
$full_link = $full_link." &nbsp; | &nbsp <a href='~\..\Download.php?file=$att4'>$att4</a>";
}
$resultx1 = mysqli_query($con, "SELECT COUNT(*) AS cnt FROM lab_report_submissions WHERE lab_report_submissions.Lab_Report_ID=$id");
while ($row = mysqli_fetch_assoc($resultx1)) {
$count_subs = $row['cnt'];
}
$resultx1 = mysqli_query($con,"Select Count(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id");
while($row = mysqli_fetch_assoc($resultx1)) {$count_subs=$row['cnt'];}
$resultx2 = mysqli_query($con,"Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Marks is not null");
if(mysqli_num_rows($resultx2)==0){$count_marked=0;} else { while($row = mysqli_fetch_assoc($resultx2)) {$count_marked =$row['cnt'];}}
$resultx2 = mysqli_query($con, "SELECT COUNT(*) AS cnt FROM lab_report_submissions WHERE lab_report_submissions.Lab_Report_ID=$id AND Marks IS NOT null");
if (mysqli_num_rows($resultx2) == 0) {
$count_marked = 0;
} else {
while ($row = mysqli_fetch_assoc($resultx2)) {
$count_marked = $row['cnt'];
}
}
$header="Courses > ".$name."($code) > Assignments > ".$title;
echo " <div class='break-word btn btn-default' style='word-wrap: break-word;border-color:grey;'>
$title ($as_type) <br> $ins
echo " <div class='card mt-md-2'>
<div class='card-body'>
<h5 class='card-title'>$title ($marks Marks, $as_type)</h5>
<h6 class='card-subtitle'>$ins</h6>
<p class='card-text text-muted'><small>Posted: $posted &nbsp;&nbsp; Deadline: $deadline</small></p>
<p class='card-text'>$count_subs Submissions ( $count_marked Marked )</p>
<a class='card-link' href='Courses.php?course=".$url."&act=edit&cid=".$id."'> Edit </a>
<a class='card-link' href='~\..\Submissions.php?id=$id&header=$header&total=$marks' onclick=''> View </a>
<a class='card-link' href='#' onclick='extendDeadline($id)'> Extend Deadline </a>
<p class='card-text'> Attachments: $full_link</p>
</div>
</div>";
<br> <span style='font-size:8pt'>Posted : $posted Deadline : <b> $deadline </b> &nbsp; ($marks Marks) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "
. "<br>"
. "<span class='btn-default'> &nbsp;&nbsp; $count_subs Submissions ( $count_marked Marked ) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='Courses.php?course=".$url."&act=edit&cid=".$id."'>Edit</a>&nbsp;&nbsp; |&nbsp;&nbsp;<a href='~\..\Submissions.php?id=$id&header=$header&total=$marks' onclick=''> View </a> &nbsp;&nbsp; |&nbsp;&nbsp; <a href='#' onclick='extend_deadline($id)'> Extend Deadline </a> </span> <hr> Attachments : $full_link </span>"
. "&nbsp;&nbsp;</div>
";
}}
}
}
echo "</div>";
$resultx1 = mysqli_query($con,"SELECT course_students_table.Student_ID,users_table.Full_Name FROM
`course_students_table`
$resultx1 = mysqli_query($con, "SELECT course_students_table.Student_ID, users_table.Full_Name
FROM course_students_table
INNER JOIN users_table on users_table.Student_ID=course_students_table.Student_ID
WHERE Course_ID=$course_id");
echo "<span id='dropstudents' style='display:none;'> <select name='stdid'>";
while($row = mysqli_fetch_assoc($resultx1))
{
$stdid=$row['Student_ID'];
echo "<span id='dropstudents' style='display:none;'> <select name='studentid'>";
while($row = mysqli_fetch_assoc($resultx1)) {
$studentid = $row['Student_ID'];
$stdname = $row['Full_Name'];
echo "<option value='$stdid'> $stdname($stdid) </option> ";
echo "<option value='$studentid'> $stdname($studentid) </option> ";
}
echo "</select><br>Reason <input type='text' name='reason'>"
. "<input type='hidden' name='url' value='$course_url'>"
. " </span>";
return;
}
?>
@ -373,29 +350,23 @@ WHERE Course_ID=$course_id");
<?php
$user_name = $_SESSION['user_fullname'];
echo " <div class='alert' style='margin-left:20px;border-bottom:2px solid #1D91EF;'> <a href='~\..\Courses.php?course=$url'>
Course Portal > $user_name (Lecturer) > Course Listing
<br> <span style='font-size:8pt'> </span>
</a></div>
";
echo "<h1 class='display-6'>My courses</h1>";
$result = mysqli_query($con, "SELECT Course_ID, Course_Name, Academic_Year, Faculty, Lecturer_User_ID, TA_User_ID, Course_Code, URL, Verify_New_Members, users_table.Full_Name
FROM courses_table
INNER JOIN users_table ON users_table.User_ID=courses_table.Lecturer_User_ID
WHERE courses_table.Lecturer_User_ID=$user_id
ORDER BY Academic_Year DESC, URL ASC");
$result = mysqli_query($con,"SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`, "
. "`Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` , users_table.Full_Name FROM `courses_table` INNER JOIN users_table ON users_table.User_ID=courses_table.Lecturer_User_ID where courses_table.Lecturer_User_ID=$user_d");
if($_SESSION['user_type']=="TA")
{
$result = mysqli_query($con,"SELECT course_ta.Course_ID, `Course_Name`,
`Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` FROM `courses_table`
INNER JOIN
course_ta ON course_ta.Course_ID=courses_table.Course_ID where course_ta.TA=$user_d");
if ($_SESSION['user_type'] == "TA") {
$result = mysqli_query($con, "SELECT course_ta.Course_ID, Course_Name, Academic_Year, Faculty, Lecturer_User_ID, TA_User_ID, Course_Code, URL, Verify_New_Members
FROM courses_table
INNER JOIN course_ta ON course_ta.Course_ID=courses_table.Course_ID
WHERE course_ta.TA=$user_id");
}
// $result = mysqli_query($con,"SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` , users_table.Full_Name FROM `courses_table` INNER JOIN users_table ON users_table.User_ID=courses_table.Lecturer_User_ID");
if(mysqli_num_rows($result)==0)
{} else { while($row = mysqli_fetch_assoc($result)) {
if (mysqli_num_rows($result) != 0) {
while ($row = mysqli_fetch_assoc($result)) {
$id = $row['Course_ID'];
$name = $row['Course_Name'];
$code = $row['Course_Code'];
@ -403,107 +374,100 @@ course_ta ON course_ta.Course_ID=courses_table.Course_ID where course_ta.TA=$use
$lecturer = $row['Full_Name'];
$academic = $row['Academic_Year'];
$url = $row['URL'];
$resultTA = mysqli_query($con,"SELECT `Course_ID`, `TA`,users_table.Full_Name as TA_NAME FROM `course_ta`
INNER JOIN users_table on users_table.User_ID=course_ta.TA
where course_ta.Course_ID=$id");
$resultTA = mysqli_query($con, "SELECT Course_ID, TA, users_table.Full_Name AS TA_NAME
FROM course_ta
INNER JOIN users_table ON users_table.User_ID=course_ta.TA
WHERE course_ta.Course_ID=$id");
$ta = "";
while ($rowTA = mysqli_fetch_assoc($resultTA)) {
$ta=$ta." - ".$rowTA['TA_NAME'];
$ta = $ta." ".$rowTA['TA_NAME'];
}
if ($ta == "") {
$ta = " None";
}
echo"
<a href='~\..\Courses.php?course=$url'> <div class='btn btn-default'>
echo" <a href='~\..\Courses.php?course=$url'>
<div class='btn btn-default'>
($code) - $name
<br> <span style='font-size:8pt'>Faculty : $faculty &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Year : $academic &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lecturer :$lecturer &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TA:$ta </span>
</div></a>
";
<p class='text-muted'><small> Faculty: $faculty &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Year: $academic &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lecturer: $lecturer &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TA:$ta </small></p>
</div>
</a>";
}
}
?>
}}?>
</div>
<div class="col-md-4">
<br>
<b> Course Joining Requests </b>
<b> Course joining requests </b>
<?php
$lecturer_id= $_SESSION['user_id'];
$result = mysqli_query($con,"SELECT course_students_table.ID,users_table.Full_Name, courses_table.Course_ID, `Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` FROM `courses_table`
INNER JOIN course_students_table on course_students_table.Course_ID=courses_table.Course_ID
INNER JOIN users_table on users_table.Student_ID=course_students_table.Student_ID
WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'");
$result = mysqli_query($con, "SELECT course_students_table.ID, users_table.Full_Name, courses_table. Course_ID, Course_Name, Academic_Year, Faculty, Lecturer_User_ID, TA_User_ID, Course_Code, URL, Verify_New_Members
FROM courses_table
INNER JOIN course_students_table ON course_students_table.Course_ID=courses_table.Course_ID
INNER JOIN users_table ON users_table.Student_ID=course_students_table.Student_ID
WHERE Lecturer_User_ID=$lecturer_id AND course_students_table.Status='Pending'");
if(mysqli_num_rows($result)==0)
{
echo "<br> <i class='fa fa-info-circle'></i> No Course joining request so far for all your courses <hr>";
} else { while($row = mysqli_fetch_assoc($result)) {
if(mysqli_num_rows($result) == 0) {
echo "<br> <i class='fa fa-info-circle'></i>No course-joining request so far for your courses<hr>";
} else {
while ($row = mysqli_fetch_assoc($result)) {
$id = $row['ID'];
$name = $row['Course_Name'];
$code = $row['Course_Code'];
$faculty = $row['Faculty'];
$std_name=$row['Full_Name'];
$student_name = $row['Full_Name'];
$academic = $row['Academic_Year'];
echo "<div class='btn btn-default'>
$std_name is Requesting to join <br> [($code) - $name ] &nbsp;&nbsp;&nbsp;&nbsp; <br><a href='~\..\Script.php?AcceptStudent=y&id=$id&rs=yes' class='btn-sm btn-success' onclick=return confirm(\"are you sure to join this course?\")' > Accept </a>
&nbsp;&nbsp;<a href='~\..\Script.php?AcceptStudent=y&id=$id&rs=no' class='btn-sm btn-danger' onclick=return confirm(\"are you sure to join this course?\")' > Decline </a>
$student_name is Requesting to join <br> [($code) - $name ] &nbsp;&nbsp;&nbsp;&nbsp; <br>
<a href='~\..\Script.php?AcceptStudent=y&id=$id&rs=yes' class='btn btn-sm btn-success' onclick=return confirm(\"are you sure to join this course?\")' > Accept </a> &nbsp;&nbsp;<a href='~\..\Script.php?AcceptStudent=y&id=$id&rs=no' class='btn btn-sm btn-danger' onclick=return confirm(\"are you sure to join this course?\")' > Decline </a>
</div>";
}
}
?>
<?php
if( $_SESSION['user_type']=="TA")
{
echo "<center>Only Lecturers can Post new Lab report Assignments</center>";
if ($_SESSION['user_type'] == "TA") {
echo "<center>Only Lecturer can post assignments</center>";
}
if( $_SESSION['user_type']=="Lecturer"){ ?>
<b>Create new Course Portal </b>
if ($_SESSION['user_type'] == "Lecturer"){
?>
<b>Create a new course</b>
<form method="post" action="Script.php">
<input type="hidden" name="frm_createCourse" value="true" required=""/>
<input type="hidden" name="form_createCourse" value="true" required=""/>
<input type="hidden" name="l" value="l" required=""/>
Course Name
Course name
<input type="text" name="name" placeholder="Course Name" class="form-control" required="">
Course Code
Course code
<input type="text" name="code" placeholder="Course Code" class="form-control" required="">
URL (Leave blank to use Course Code & Year)
URL (leave blank to use course code & year)
<input type="text" name="url" placeholder="Choose Custom URL " class="form-control">
Academic Year
Academic year
<input type="text" name="academic" placeholder="Academic Year" class="form-control" required="">
Faculty <br>
<input type="text" name="faculty" placeholder="Faculty" class="form-control" required="">
<input type="hidden" name="lecturer" value="<?php echo $_SESSION['user_id']; ?>">
Verify Joining Students
Verify joining students?
<input type="radio" name="verify" value="1"> Yes
<input type="radio" name="verify" value="0" checked=""> No
<br>
<input type="submit" class="btn btn-primary" value="Create Portal"><br>
<br><br>
<input type="submit" class="btn btn-primary" value="Create"><br>
</form>
@ -511,24 +475,20 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'"
</div>
<!-- END LECTURER -->
<?php
}
if( $_SESSION['user_type']=="Student")
{
if ($_SESSION['user_type'] == "Student") {
?>
<!--STUDENT CODE-->
<div class="row" style="width:80%;margin:auto; text-align:left;">
<div class="row">
<div class="col-md-6">
<br> Course Portal > Students <br>
<?php
<?php
error_reporting(0);
if (isset($_SESSION['info_Courses_student'])) {
echo '<hr><span class="alert alert-success" role="alert">' . $_SESSION['info_Courses_student'] . '</span>';
@ -541,52 +501,41 @@ if( $_SESSION['user_type']=="Student")
</div>
<div class="row" style="width:80%;margin:auto; text-align:left;">
<div class="row">
<div class="col-md-6">
<?php
error_reporting(0);
$student_id = $_SESSION['user_student_id'];
// current academic year - i.e 2021 - 2022 , so we will show in search result:
// course containing either 2021 or 2022 as academic year.
$oldest_academic_year = date('Y') - 1;
if(!empty($_GET["search"]) || !empty($_GET["faculty"]))
{
if (!empty($_GET["search"]) || !empty($_GET["faculty"])) {
$search = trim(mysqli_real_escape_string($con, $_GET["search"]));
$search = strtoupper($_GET['search']);
$search = strtoupper($search); # was strtoupper($_GET['search']);
$faculty = mysqli_real_escape_string($con, $_GET["faculty"]);
// the user has not entered something under "Find course by Code"
if($faculty=="")
{
echo "<h4> Search Results for Course Code $search</h4><hr>";
$result = mysqli_query($con,"SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`,"
. " `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` "
. " , users_table.Full_Name FROM `courses_table` INNER JOIN users_table"
. " ON users_table.User_ID=courses_table.Lecturer_User_ID where Academic_Year >= $oldest_academic_year and Course_Code like '%{$search}%' and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id) order by Academic_Year desc");
}
// the user has entered something under "Find course by Code"
else
{
echo "<h3> Find Courses under faculty $faculty</h3>";
$result = mysqli_query($con,"SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`,
`Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members`
, users_table.Full_Name FROM `courses_table` INNER JOIN users_table
ON users_table.User_ID=courses_table.Lecturer_User_ID where Academic_Year >= $oldest_academic_year and Faculty='$faculty' and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id) order by Academic_Year desc");
if ($search != "") {
echo "<h4>Search results for course code: $search </h4><hr>";
$result = mysqli_query($con, "SELECT Course_ID, Course_Name, Academic_Year, Faculty, Lecturer_User_ID, TA_User_ID, Course_Code, URL, Verify_New_Members, users_table.Full_Name
FROM courses_table
INNER JOIN users_table
ON users_table.User_ID=courses_table.Lecturer_User_ID
WHERE Academic_Year >= $oldest_academic_year AND Course_Code LIKE '%{$search}%' AND courses_table.Course_ID NOT IN
(SELECT course_id FROM course_students_table WHERE Student_ID=$student_id) ORDER BY Academic_Year DESC");
} else if ($faculty != "") { // the user has entered something under "Find course by Code"
echo "<h3> Find courses under faculty: $faculty</h3>";
$result = mysqli_query($con, "SELECT Course_ID, Course_Name, Academic_Year, Faculty, Lecturer_User_ID, TA_User_ID, Course_Code, URL, Verify_New_Members, users_table.Full_Name
FROM courses_table
INNER JOIN users_table ON users_table.User_ID=courses_table.Lecturer_User_ID
WHERE Academic_Year >= $oldest_academic_year AND Faculty='$faculty' AND courses_table.Course_ID NOT IN
(SELECT course_id FROM course_students_table WHERE Student_ID=$student_id) ORDER BY Academic_Year DESC");
}
if(mysqli_num_rows($result)==0)
{
echo "No results found for your Search <hr>";
if (mysqli_num_rows($result) == 0) {
echo "No results. <hr>";
} else {
while($row = mysqli_fetch_assoc($result)) {
$name = $row['Course_Name'];
$code = $row['Course_Code'];
@ -596,199 +545,98 @@ if( $_SESSION['user_type']=="Student")
$url = $row['URL'];
$id = $row['Course_ID'];
$v = $row['Verify_New_Members'];
$msg2="Join Course";
if($v>0)
{
if($v > 0) {
$msg = "<i class='fa fa-exclamation-circle'></i> Lecturer verification required";
$msg2 = "Send Joining Request";
}
echo "<div class='btn btn-default' style='word-wrap:break-word'>
[$code] $name <br>($url) <br> <a href='~\..\Script.php?JoinCourse=y&id=$id&std=$student_id&joining=$v' class='btn-sm btn-success' onclick=return confirm(\"Are you sure to join this course?\")' > $msg2 </a>
<br> <span style='font-size:10pt'>Faculty: $faculty | Year: $academic | Lecturer: $lecturer </span><br>$msg</div>
";
($code) $name <br>($url) <br>
<a href='~\..\Script.php?JoinCourse=y&id=$id&std=$student_id&joining=$v' class='btn btn-sm btn-success' onclick=return confirm(\"Are you sure to join this course?\")' >Join</a> <br>
<span style='font-size:10pt'>Faculty: $faculty &nbsp; Year: $academic &nbsp; Lecturer: $lecturer </span><br>
$msg
</div>";
}
}
}
// Otherwise, list the student's joined courses (already done), in reverse chronological order
echo "<h4> My Courses </h4>";
$result = mysqli_query($con,"SELECT users_table.Full_Name, course_students_table.Status, courses_table.Course_ID, `Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` FROM `courses_table`
INNER JOIN users_table
ON users_table.User_ID=courses_table.Lecturer_User_ID
echo "<h1 class='display-6'> My courses </h1>";
$result = mysqli_query($con, "SELECT users_table.Full_Name, course_students_table.Status, courses_table.Course_ID, Course_Name, Academic_Year, Faculty, Lecturer_User_ID, TA_User_ID, Course_Code, URL, Verify_New_Members
FROM courses_table
INNER JOIN users_table ON users_table.User_ID=courses_table.Lecturer_User_ID
INNER JOIN course_students_table ON course_students_table.Course_ID=courses_table.Course_ID
WHERE course_students_table.Student_ID=$student_id ORDER BY Academic_Year DESC, URL ASC");
INNER JOIN course_students_table on course_students_table.Course_ID=courses_table.Course_ID
where course_students_table.Student_ID=$student_id order by Academic_Year desc");
if(mysqli_num_rows($result)==0)
{
echo "<i class='fa fa-exclamation-circle'></i> You are not Enrolled in any Course";
if (mysqli_num_rows($result) == 0) {
echo "<i class='fa fa-exclamation-circle'></i> You are not enrolled in any Course";
} else {
while($row = mysqli_fetch_assoc($result)) {
$name = $row['Course_Name'];
$code = $row['Course_Code'];
$faculty = $row['Faculty'];
$lecturer = $row['Full_Name'];
$academic=$row['Academic_Year'];
$academic_year = $row['Academic_Year'];
$url = $row['URL'];
$id = $row['Course_ID'];
$Status=$row['Status'];
if($Status=="Joined")
{
echo "<a href='~\..\Course.php?url=$url'> <div class='btn btn-default' style='word-wrap:break-word'>
($code) - $name <br>($url) &nbsp;&nbsp;&nbsp; <i class='fa fa-check-circle'></i> $Status &nbsp;&nbsp;&nbsp;&nbsp; <a href='~\..\Course.php?url=$url' class='btn-sm btn-primary'> Open</a>
<br> <span style='font-size:8pt'>Faculty : $faculty Year : $academic Lecturer :$lecturer </span></div></a>
";
}
else
{
$status = $row['Status'];
if($status == "Joined") {
echo "<a href='~\..\Course.php?url=$url'>
<div class='btn btn-default' style='word-wrap:break-word'>
($code) $name <br>
($url) &nbsp;&nbsp;&nbsp; <i class='fa fa-check-circle'></i> $status &nbsp;&nbsp;&nbsp;&nbsp; <br>
<span style='font-size:8pt'>Faculty: $faculty &nbsp; Year: $academic_year &nbsp; Lecturer: $lecturer </span>
</div>
</a>";
} else {
echo "<div class='btn btn-default'>
($code) - $name <i class='btn-sm btn-danger'> $Status</i>
<br> <span style='font-size:8pt'>Faculty : $faculty Year : $academic Lecturer :$lecturer </span></div>
";
($code) $name <i class='btn btn-sm btn-danger'> $status</i> <br>
<span style='font-size:8pt'>Faculty: $faculty &nbsp; Year: $academic_year &nbsp; Lecturer: $lecturer </span>
</div>";
}
}
}
echo "</div><div class='col-md-6'>
<form method='get' action='Courses.php'>
<div class='row'>
<div class='col-md-10'>
<div class='row'><div class='col-md-6'> Find course by Code
<input type='text' class='form-control' name='search' maxlength='11' placeholder='Enter Course Code'>
</div><div class='col-md-6'>
<div class='col-md-12'>
<div class='row'>
<div class='col-md-5'>
Find new course by course code
<input type='text' class='form-control' name='search' maxlength='11' placeholder='Enter course code'>
</div>
<div class='col-md-5'>
List courses by faculty
<select name='faculty' class='form-control'>";
$result = mysqli_query($con,"SELECT DISTINCT(Faculty) as Faculty FROM `courses_table`");
if(mysqli_num_rows($result)==0){
} else {
echo"<option value=''> Search by faculty </option>";
$result = mysqli_query($con, "SELECT DISTINCT(Faculty) AS Faculty FROM courses_table");
if (mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_assoc($result)) {
$fname=$row['Faculty'];
echo " <option value='$fname'> $fname </option>";
}}
$faculty = $row['Faculty'];
echo " <option value='$faculty'> $faculty </option>";
}
}
echo "</select></div></div>
</div>
<div class='col-md-1'> <br>
<input type='submit' class='btn btn-primary' value='Find'>
echo " </select>
</div>
<div class='col-md-2'> <br>
<button type='submit' class='btn btn-primary'>Find</button>
</div>
</div>
</div>
</div>
</form>
</div></div>";
}
?>
<?php include 'Footer.php';?>
</div>
<style>
.form-control{
padding-top: 1px;
padding-bottom:1px;
}
</style>
</body>
</html>

View File

@ -25,7 +25,7 @@ $type = filetype($file);
$today = date("F j, Y, g:i a");
$time = time();
if ((isset($_SESSION["user_student_id"]) && strpos($file, $_SESSION["user_student_id"]) > 0) || $_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "TA" ) {
if ((isset($_SESSION["user_student_id"]) && (strpos($file, $_SESSION["user_student_id"]) > 0 || strpos($file, "Lab_Report_Assignments"))) || $_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "TA" ) {
// 发送文件头部
header("Content-type: $type");
header('Content-Disposition: attachment;filename="'.urldecode($filename).'"');

View File

@ -1,4 +1,3 @@
<br><br><br><br><br><br><br><br><br>
<div style="background-color:white;width:100%di">
</div>
<?php
echo "<p id='myfooter' class='text-center'>Copyright &copy; 2018-" . date("Y") . " The Authors</p>";
?>

View File

@ -10,105 +10,41 @@ $con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
<!DOCTYPE html>
<html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>LRR</title>
<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>
<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" />
<link href="./css/bootstrap.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
-->
<link href = "./css/main.css" rel="stylesheet" type="text/css" />
<script src="./css/jquery.min.js" type="text/javascript"></script>
<script src="./css/bootsrap.min.js" type="text/javascript"></script>
<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>
<script src="./css/jquery.datetimepicker.min.js" type="text/javascript"></script>
</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">
<li class="nav-item active">
<!-- <a class='nav-link' href='~\..\Visitors.php'> <i class='fa fa-globe'></i> Visitor Portal <span class='sr-only'>(current)</span></a> -->
</li>
<?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 &nbsp; <b> <?php echo $_SESSION['user_fullname']; ?> </b> &nbsp;
<?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") {
echo "&nbsp;&nbsp;&nbsp; <i class=\"fa fa-cog\" style=\"color:#fff;\"> </i> &nbsp;<a style='color:#fff !important' href=\"~\..\Admin.php\" id=\"admin_tab\">Admin </a>";
}
?>
&nbsp;&nbsp;&nbsp; <i class="fa fa-user" style="color:#fff;"> </i>
&nbsp;<a href="#" style='color:#fff !important' onclick="updatePass(<?php echo $_SESSION['user_id']; ?>)">Update password</a>
&nbsp;&nbsp;&nbsp; <i class="fa fa-lock" style="color:#fff;"> </i> &nbsp;<a style='color:#fff !important' href="~\..\logout.php">Logout </a>
<?php
}
?>
</form>
</div>
</nav>
<style>
.nav-item {
border-color: #00ff66;
}
.nav-tabs {
border-color: #00ff66;
}
.btn-default {
border: 2px solid #00ff66;
border: 2px solid #f8f8f8;
width: 100%;
text-align: left;
margin: 3px auto;
font-weight: bold;
font-size: 13pt;
margin: 4px auto;
}
.table-bordered {
padding: 5px !important;
}
.alert {
font-weight: bold;
.btn-default:hover {
background: #f8f8f8;
}
h1,
@ -154,12 +90,100 @@ if (mysqli_connect_errno()) {
background: #03488B;
color: white
}
.ui-dialog-titlebar-close::before {
content: "X";
position: absolute;
top: 1px;
left: 3px;
line-height: 1rem;
}
#footer{
position:fixed;
bottom:0;
left:0;
text-align:center;
width:100%;
}
.form-control{
padding-top: 1px;
padding-bottom:1px;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg bg-body-tertiary" style="padding-left:180px;padding-right:150px;margin:auto;">
<div class="container-fluid">
<a class="navbar-brand" href="~\..\index.php"> <img src="logo.png" style="width:30px;height:30px;" alt="LRR Logo"> LRR </a>
<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>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-link" href="#">
<?php
if (isset($_SESSION["user_fullname"])) {
echo "<b>" . $_SESSION['user_fullname'] . "</b>";
}
?>
&nbsp;
<?php
$c_date = date("Y-m-d H:i");
if (isset($_SESSION['user_student_id']))
echo "(" . $_SESSION['user_type'] . " ID: " . $_SESSION['user_student_id'] . ") ";
elseif (isset($_SESSION['user_type']))
echo "(" . $_SESSION['user_type'] . ") ";
?>
</a>
<?php
if (isset($_SESSION["user_fullname"])) {
if ($_SESSION['user_type'] == "Student" || $_SESSION['user_type'] == 'Lecturer') {
echo "<a class='nav-link' href='~\..\Courses.php'><i class='fa fa-book'></i> My courses </a>";
}
?>
<?php
if ($_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == 'Admin') { // Show Admin link
echo "&nbsp;&nbsp;&nbsp;&nbsp;<a class='nav-link' href=\"~\..\Admin.php\" id=\"admin_tab\"><i class='fa fa-cog'></i>Admin</a>";
}
?>
&nbsp;&nbsp;&nbsp;&nbsp;
<a class="nav-link" href="#" onclick="updatePass(<?php echo $_SESSION['user_id']; ?>)"><i class="fa fa-user"> </i> Update password</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a class="nav-link" href="~\..\logout.php"><i class="fa fa-lock"> </i> Logout</a>
<?php
} // Closing this conditional test block: if (isset($_SESSION["user_fullname"])) { ...
?>
</div>
</div>
</div>
</nav>
<script>
function updatePass(id) {
var pass = prompt("Enter your new password : ", "Enter a strong password");
const pass = prompt("Enter your new password : ", "Enter a strong password");
if (!confirm('Are you sure you want to reset your password?')) {
return;
@ -168,10 +192,4 @@ if (mysqli_connect_errno()) {
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>

View File

@ -27,8 +27,8 @@ LRR needs Apache and MySQL to run. I followed [How To Install Linux, Apache, My
LRR uses a database called `lrr`. So create this database using MySQL root account. Open MySQL's prompt using `sudo mysql`. Create the database using command `CREATE DATABASE lrr;`, and grant all privileges to MySQL user `lrr` using command `GRANT ALL PRIVILEGES ON lrr.* TO 'mnc'@'localhost' WITH GRANT OPTION;`. If MySQL user mnc does not exist, create it using command `CREATE USER 'mnc'@'localhost' IDENTIFIED BY 'password'`.
To facilitate data migration, I need to export the existing `lrr` to a plain text file (including many sql commands) and import that text file to the newly created `lrr` database on the new server.
The command for exporting the database is `mysqldump -u mnc -p lrr > lrr_database_dump.txt`, where mnc after -u is MySQL's username, and lrr after -p is the database name.
The command for importing is `mysql -u mnc -p lrr < lrr_database_dump.txt`. Read [How to Import and Export MySQL Databases in Linux](https://phoenixnap.com/kb/import-and-export-mysql-database) for more detail. Do not have lrr_database_dump.txt? You can use lrr_database.sql in this repo instead.
The command for exporting the database is `mysqldump -u mnc -p lrr > lrr_database_dump.sql`, where mnc after -u is MySQL's username, and lrr after -p is the database name.
The command for importing is `mysql -u username -p lrr < lrr_database_dump.sql`. You must create database `lrr` first on your computer before doing the import. Read [How to Import and Export MySQL Databases in Linux](https://phoenixnap.com/kb/import-and-export-mysql-database) for more detail. Do not have lrr_database_dump.sql? You can use lrr_database.sql in this repo instead.
LRR also needs to store assignment submissions. We store them in a folder called `../../lrr_submission`. Note that `lrr_submission` is two levels above the project folder (where many PHP files reside). I copied this folder from the existing one. I think it is also OK if you create an empty folder.
We need to set a proper owner and accessibility for `lrr_submission` using the following two commands:
@ -51,6 +51,31 @@ Enable the site lrr: `sudo a2ensite lrr`. Restart the apache server: `sudo syst
Visit the LRR application by entering this URL in a web browser: http://121.4.94.30/.
### Solving the coding problems in the dump file
If the database contains Chinese characters, the dump file (e.g., lrr_database_dump.sql) may contain *weird* characters, e.g., `研究生`, so weird that no one can tell their meaning.
We need to correct these abnormal characters before we import them to the new database, so that the PHP program can correctly display Chinese information.
The simplest solution is using the ftfy (fixes text for you) Python package to convert them, as follows:
```
from ftfy import fix_text
with open('lrr_database_dump.sql') as f:
content = f.read()
content2 = fix_text(content)
with open('lrr_database_dump_sql_fixed.txt', 'w') as f:
f.write(content2)
```
Now, import data using lrr_database_dump_sql_*fixed*.txt.
If you encounter the 'Unknown MySQL server host' problem during import, replace all apostrophes with a space in the dump file. For example, if a database table field contains *can't*, then the apostrophe between *n* and *t* can cause that problem.
## Enock steps
Enock, a graduate student here, has made a tutorial about how he deployed LRR to a remote server (http://lanlab.org/course/2021s/spm/PuTTY-Server.txt).

View File

@ -1,49 +0,0 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
include 'Header.php';
$token = htmlspecialchars($_GET['token']);
$email = htmlspecialchars($_GET['email']);
?>
<div class="row">
<div class="col-md-4 list-group" style="margin:auto;">
<br>
<h4 class="list-group-item active"> Reset your password </h4>
<div class="list-group-item">
<div class="panel-body">
<form method="post" action="Script.php" >
<input type="hidden" name="frm_reset_password" value="true"/>
<input type="hidden" name="token" value="<?php echo $token ?>"/>
Email
<input type="text" name="email" readonly="" placeholder="Enter your Email" class="form-control" value="<?php echo $email; ?>">
<br>
New Password
<input type="password" name="password" placeholder="Enter your new Password" class="form-control" value="">
<br>
<input type="submit" class="btn btn-primary" value="Reset">
<br>
<?php
?>
</form>
</div>
</div>
</div>
</div>
</form>
</div>
</div>

View File

@ -126,7 +126,7 @@ if (!empty($_POST["form_signup"])) {
// ################################ LOGIN #####################################
if (!empty($_POST["frm_login"])) {
if (!empty($_POST["form_login"])) {
$user = mysqli_real_escape_string($con, $_POST["user"]); // user could be a 12-digit student number or an email address
$is_student_number = 0;
@ -187,7 +187,7 @@ if (!empty($_POST["frm_login"])) {
// ################################ Recover Password #####################################
if (!empty($_POST["frm_recover_password"])) {
if (!empty($_POST["form_recover_password"])) {
$student_id = mysqli_real_escape_string($con, $_POST["sno"]);
$email = mysqli_real_escape_string($con, $_POST["email"]);
@ -220,7 +220,7 @@ if (!empty($_POST["frm_recover_password"])) {
// ################################ RESET Password #####################################
if (!empty($_POST["frm_reset_password"])) {
if (!empty($_POST["form_reset_password"])) {
$password = mysqli_real_escape_string($con, $_POST["password"]);
$token = mysqli_real_escape_string($con, $_POST["token"]);
$email = mysqli_real_escape_string($con, $_POST["email"]);
@ -264,7 +264,7 @@ if (!empty($_POST["frm_reset_password"])) {
}
// ############################### CREATE Lecturer/TA USER ##################################
if (!empty($_POST["frm_createlecturrer"])) {
if (!empty($_POST["form_createlecturrer"])) {
$email = mysqli_real_escape_string($con, $_POST["email"]);
$fullname = mysqli_real_escape_string($con, $_POST["fullname"]);
$type = mysqli_real_escape_string($con, $_POST["type"]);
@ -340,7 +340,7 @@ function mkdirs($path)
}
// ############################### #Post Assignment ##################################
if (!empty($_POST["frm_uploadlab"])) {
if (!empty($_POST["form_uploadlab"])) {
$course_id = mysqli_real_escape_string($con, $_POST["course_id"]);
$deadlinedate = $_POST["deadlinedate"];
@ -357,7 +357,7 @@ if (!empty($_POST["frm_uploadlab"])) {
// GET UPLOADED FILES
$target_dir = Create_dir("Lab_Report_Assignments/" . $title . "/");
$target_dir = Create_dir("./../../lrr_submission/Lab_Report_Assignments/$course_id/" . $title . "/");
$rnd = rand(10, 1000);
$rnd = ""; // no more required , creating folder for each lab
@ -416,16 +416,16 @@ if (!empty($_POST["frm_uploadlab"])) {
$targetfile4 = "";
if ($_FILES['attachment1']['name'] != "") {
$targetfile = "/" . $title . "/" . $_FILES['attachment1']['name'];
$targetfile = "/Lab_Report_Assignments/$course_id/" . $title . "/" . $_FILES['attachment1']['name'];
}
if ($_FILES['attachment2']['name'] != "") {
$targetfile2 = "/" . $title . "/" . $_FILES['attachment2']['name'];
$targetfile2 = "/Lab_Report_Assignments/$course_id" . $title . "/" . $_FILES['attachment2']['name'];
}
if ($_FILES['attachment3']['name'] != "") {
$targetfile3 = "/" . $title . "/" . $_FILES['attachment3']['name'];
$targetfile3 = "/Lab_Report_Assignments/$course_id" . $title . "/" . $_FILES['attachment3']['name'];
}
if ($_FILES['attachment4']['name'] != "") {
$targetfile4 = "/" . $title . "/" . $_FILES['attachment4']['name'];
$targetfile4 = "/Lab_Report_Assignments/$course_id" . $title . "/" . $_FILES['attachment4']['name'];
}
$sql = "INSERT INTO `lab_reports_table`(`Course_ID`, `Posted_Date`, `Deadline`, `Instructions`,
@ -452,7 +452,7 @@ function checksize($file)
}
// ############################### Submit Assignment ##################################
if (!empty($_POST["frm_submitlab"])) {
if (!empty($_POST["form_submitlab"])) {
$lab_id = mysqli_real_escape_string($con, $_POST["lab_id"]);
$student_id = $_POST["student_id"];
@ -585,7 +585,7 @@ if (!empty($_POST["frm_submitlab"])) {
$con->query($sql = "UPDATE `lab_report_submissions` SET `Course_Group_id` = '0' WHERE `lab_report_submissions`.`Lab_Report_ID` = '$lab_id'");
}
$_SESSION["info_courses"] = "Thanks. Your lab report assignment is submitted successfully.";
$_SESSION["info_courses"] = "Thanks. You have successfully submitted your assignment.";
header("Location: Course.php?url=" . $url);
} else {
echo "Error: <br>" . $con->error;
@ -648,7 +648,7 @@ if (!empty($_GET["savemarks"])) {
if ($con->query($sql) === TRUE) {
$_SESSION["info_Marking"] = "Lab Report Submission Marked";
$_SESSION["info_Marking"] = "Assignment marked";
header("Location: Submissions.php?id=" . $labid . "&header=" . $header . "&total=" . $total);
} else {
echo "Error: " . $sql . "<br>" . $con->error;
@ -692,7 +692,7 @@ if (!empty($_GET["remarking"])) {
if ($con->query($sql) === TRUE) {
$_SESSION["info_general"] = "Remarking Request Sent";
$_SESSION["info_general"] = "Remarking request sent";
header("Location: Course.php?url=" . $url);
} else {
echo "Error: " . $sql . "<br>" . $con->error;
@ -815,7 +815,7 @@ if (!empty($_GET["acceptinvite"])) {
}
if ($con->query($sql) === TRUE) {
$_SESSION["info_general"] = " Group Invite Updated";
$_SESSION["info_general"] = " Group invitation status updated";
header("Location: Course.php?url=" . $url);
} else {
echo "Error: " . $sql . "<br>" . $con->error;
@ -833,7 +833,7 @@ if (!empty($_GET["removemember"])) {
$sql = "Delete from `course_group_members_table` where student_id=$student_id and Course_Group_id=$group_id";
if ($con->query($sql) === TRUE) {
$_SESSION["info_general"] = " Member " . $student_id . " removed from the group";
$_SESSION["info_general"] = " Member " . $student_id . " is gone.";
header("Location: Course.php?url=" . $url);
} else {
echo "Error: " . $sql . "<br>" . $con->error;
@ -867,7 +867,7 @@ if (!empty($_GET["extenddeadline"])) {
$time = mysqli_real_escape_string($con, $_GET["time"]);
$type = mysqli_real_escape_string($con, $_GET["type"]);
$stdid = mysqli_real_escape_string($con, $_GET["stdid"]);
$studentid = mysqli_real_escape_string($con, $_GET["studentid"]);
$reason = mysqli_real_escape_string($con, $_GET["reason"]);
$url = mysqli_real_escape_string($con, $_GET["url"]);
$deadline = $date . " " . $time;
@ -877,12 +877,12 @@ if (!empty($_GET["extenddeadline"])) {
} else {
$sql = "INSERT INTO `extended_deadlines_table`(`Student_ID`, "
. "`Lab_Report_ID`, `Extended_Deadline_Date`,"
. " `ReasonsForExtension`) VALUES ('$stdid','$id','$deadline','$reason')";
. " `ReasonsForExtension`) VALUES ('$studentid','$id','$deadline','$reason')";
}
if ($con->query($sql) === TRUE) {
$_SESSION["info_courses"] = " Lab Report Deadline extended successfully.";
$_SESSION["info_courses"] = " Assignment deadline extended successfully.";
header("Location: Courses.php?course=" . $url);
} else {
echo "Error: " . $sql . "<br>" . $con->error;
@ -903,7 +903,7 @@ if (!empty($_GET["ignoreremarking"])) {
if ($con->query($sql) === TRUE) {
$_SESSION["info_Marking"] = "Remarking Request Ignored , Submission Updated to 'Marked' status";
$_SESSION["info_Marking"] = "Remarking request ignored.";
header("Location: Submissions.php?id=" . $id . "&header=" . $header . "&total=" . $total);
} else {
echo "Error: " . $sql . "<br>" . $con->error;
@ -987,20 +987,19 @@ if (!empty($_GET["action"])) {
}
}
if ($action == "statuschange" && $_SESSION['user_id'] == $uid && ($_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "Admin")) {
if ($action == "statuschange" && ($_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "Admin")) {
$sql = "UPDATE users_table set Status='$status' where User_ID='$uid';";
if ($con->query($sql) === TRUE) {
$_SESSION["info_Admin_Users"] = $type . " user Status updated successfully ";
header("Location: Admin.php");
} else {
// echo "Error: " . $sql . "<br>" . $con->error;
echo "Something really bad happened while changing status. Contact lanhui at zjnu.edu.cn. Thanks!";
}
}
}
// ############################### CREATE STUDENT USER ##################################
if (!empty($_POST["frm_createCourse"])) {
if (!empty($_POST["form_createCourse"])) {
$name = mysqli_real_escape_string($con, $_POST["name"]);
$academic = mysqli_real_escape_string($con, $_POST["academic"]);
$lecturer = mysqli_real_escape_string($con, $_POST["lecturer"]);
@ -1096,3 +1095,4 @@ WHERE lab_report_submissions.Lab_Report_ID='$lab'";
header("Expires: 0");
print "$header\n$data";
}
?>

View File

@ -1,7 +1,6 @@
<?php
$page = "student";
include 'Header.php';
?>
<br><br><br>
@ -9,7 +8,7 @@ include 'Header.php';
<div class="row" style="width:80%;margin:auto;">
<div class="col-md-6">
<h1> Student Account Created. Now you can Browse Course Portals </h1>
<h1> Student account created. Now you can browse the course portal. </h1>
</div>
</div>

View File

@ -24,22 +24,26 @@ if (!empty($_GET["total"])) {
$total = 0;
}
$resultx1 = mysqli_query($con, "SELECT `Lab_Report_ID`,Title, lab_reports_table.Course_ID, `Posted_Date`, `Deadline`, `Marks`, `Type` , courses_table.URL FROM `lab_reports_table` INNER JOIN courses_table ON courses_table.Course_ID=lab_reports_table.Course_ID WHERE Lab_Report_ID=$id");
$resultx1 = mysqli_query($con, "SELECT Lab_Report_ID, Title, lab_reports_table.Course_ID, Posted_Date, Deadline, Marks, Type, courses_table.URL
FROM lab_reports_table
INNER JOIN courses_table ON courses_table.Course_ID=lab_reports_table.Course_ID
WHERE Lab_Report_ID=$id");
while ($row = mysqli_fetch_assoc($resultx1)) {
$Report_Type = $row['Type'];
$report_type = $row['Type'];
$c_id = $row['Course_ID'];
$Report_Title = $row['Title'];
$report_title = $row['Title'];
$url = $row['URL'];
}
echo "<div class='alert' style='margin-left:20px;border-bottom:2px solid #1D91EF;'> <a href='Courses.php?course=$url'>
$header
</a></div>
";
?>
<div class="row" style="width:80%;margin:auto; text-align:left;">
<div class="container">
<?php
echo "<div><a href='Courses.php?course=$url'> $header </a></div>";
?>
<div class="row">
<!-- Lecturer CODE-->
<?php
@ -55,89 +59,72 @@ echo "<div class='alert' style='margin-left:20px;border-bottom:2px solid #1D91EF
error_reporting(0);
if (isset($_SESSION['info_Marking'])) {
echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Marking'] . '</div>';
echo '<div class="alert alert-warning">' . $_SESSION['info_Marking'] . '</div>';
$_SESSION['info_Marking'] = null;
}
$resultx1 = mysqli_query($con, "Select Count(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id");
while ($row = mysqli_fetch_assoc($resultx1)) {
$count_subs = $row['cnt'];
}
$resultx1 = mysqli_query($con, "SELECT Count(*) AS cnt FROM lab_report_submissions WHERE lab_report_submissions.Lab_Report_ID=$id");
$row = mysqli_fetch_assoc($resultx1);
$count_submissions = $row['cnt'];
$resultx2 = mysqli_query($con, "Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Marked'");
if (mysqli_num_rows($resultx2) == 0) {
$count_marked = 0;
} else {
while ($row = mysqli_fetch_assoc($resultx2)) {
$resultx2 = mysqli_query($con, "SELECT COUNT(*) AS cnt FROM lab_report_submissions WHERE lab_report_submissions.Lab_Report_ID=$id and Status='Marked'");
$row = mysqli_fetch_assoc($resultx2);
$count_marked = $row['cnt'];
}
}
$resultx3 = mysqli_query($con, "Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Pending'");
if (mysqli_num_rows($resultx3) == 0) {
$count_unmarked = 0;
} else {
while ($row = mysqli_fetch_assoc($resultx3)) {
$resultx3 = mysqli_query($con, "SELECT COUNT(*) AS cnt FROM lab_report_submissions WHERE lab_report_submissions.Lab_Report_ID=$id and Status='Pending'");
$row = mysqli_fetch_assoc($resultx3);
$count_unmarked = $row['cnt'];
}
}
$resultx4 = mysqli_query($con, "Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Remarking'");
if (mysqli_num_rows($resultx4) == 0) {
$count_remark = 0;
} else {
while ($row = mysqli_fetch_assoc($resultx4)) {
$resultx4 = mysqli_query($con, "SELECT COUNT(*) AS cnt FROM lab_report_submissions WHERE lab_report_submissions.Lab_Report_ID=$id and Status='Remarking'");
$row = mysqli_fetch_assoc($resultx4);
$count_remark = $row['cnt'];
}
}
$resultx5 = mysqli_query($con, "SELECT COUNT(*) AS cnt FROM course_groups_table WHERE Course_id=$c_id");
$row = mysqli_fetch_assoc($resultx5);
$count_group = $row['cnt'];
?>
<b>Lab Report Submissions (<?php echo $count_subs; ?>)</b>
<br>
<p class="text-muted"><b>Total submissions (<?php echo $count_submissions; ?>)</b></p>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<ul class="nav nav-tabs" id="myTab">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#menu1">Un-Marked Submissions<b> (<?php echo $count_unmarked; ?>)</b></a>
<a class="nav-link active" href="#menu1">Unmarked submissions (<?php echo $count_unmarked; ?>)</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu2">Marked Submissions <b>(<?php echo $count_marked; ?>)</b></a>
<a class="nav-link" href="#menu2">Marked submissions (<?php echo $count_marked; ?>)</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu3">Re-Marking Requests <b>(<?php echo $count_remark; ?>)</b></a>
<a class="nav-link" href="#menu3">Remarking requests (<?php echo $count_remark; ?>)</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu4"> View Course Groups</a>
<a class="nav-link" href="#menu4">Course groups (<?php echo $count_group; ?>)</a>
</li>
</ul>
<div class="tab-content">
<div id="menu1" class="container tab-pane active"><br>
<div id="menu1" class="tab-pane active"><br>
<?php
if ($Report_Type == "Group") {
$result1 = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
`Title`,course_groups_table.Group_Name,course_groups_table.Group_Leader,users_table.Full_Name, users_table.Student_id
FROM `lab_report_submissions`
Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id
left JOIN course_groups_table on course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Submission_Date desc");
if ($report_type == "Group") {
$result1 = mysqli_query($con, "SELECT Submission_ID, Submission_Date, lab_report_submissions.Lab_Report_ID, lab_report_submissions.Course_Group_id, Attachment1, Notes, Attachment2, Attachment3, Attachment4, Marks, lab_report_submissions.Status, Title, course_groups_table.Group_Name, course_groups_table.Group_Leader, users_table.Full_Name, users_table.Student_id
FROM lab_report_submissions
LEFT JOIN users_table ON users_table.Student_ID=lab_report_submissions.Student_id
LEFT JOIN course_groups_table ON course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id
WHERE Lab_Report_ID=$id AND lab_report_submissions.Status='Pending' ORDER BY Submission_Date DESC");
} else {
$result1 = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
`Title`,users_table.Full_Name,course_group_members_table.Student_ID
FROM `lab_report_submissions`
Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id
left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Submission_Date desc");
$result1 = mysqli_query($con, "SELECT Submission_ID, Submission_Date, lab_report_submissions.Lab_Report_ID, lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, Attachment1, Notes, Attachment2, Attachment3, Attachment4, Marks, lab_report_submissions.Status, Title, users_table.Full_Name, course_group_members_table.Student_ID
FROM lab_report_submissions
LEFT JOIN users_table ON users_table.Student_ID=lab_report_submissions.Student_id
LEFT JOIN course_group_members_table ON course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id
WHERE Lab_Report_ID=$id AND lab_report_submissions.Status='Pending' ORDER BY Submission_Date DESC");
}
if (mysqli_num_rows($result1) == 0) {
echo "No Un-Marked Submissions for this Lab Report.";
echo "No unmarked submissions.";
} else {
while ($row = mysqli_fetch_assoc($result1)) {
$title = $row['Title'];
@ -182,10 +169,13 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Sub
$full_link = $full_link . " | <a href='~\..\Download.php?file=$att4&attachment=4'>$base_att4</a>";
}
echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by: <b> <span class = 'text-selectable'>$submitted_by </span> </b>
<br> <span style='font-size:8pt'>Submitted : $posted <button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Mark Submission</button><br> Attachments : $full_link </span>
</div></k>";
echo "<div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left:1px solid #eee;'>
$title <br>
By: <b> <span class='text-selectable'> $submitted_by </span> </b> <br>
<small>Submitted on: $posted</small>
<button class='btn btn-sm btn-primary' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Mark </button><br>
Attachments : $full_link
</div>";
}
}
echo "";
@ -193,39 +183,34 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Sub
</div>
<div id="menu2" class="container tab-pane"><br>
<div id="menu2" class="tab-pane"><br>
<?php
if ($Report_Type == "Group") {
$result = mysqli_query($con, "SELECT `Submission_ID`,Visibility, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
`Title`,course_groups_table.Group_Name
FROM `lab_report_submissions`
left JOIN course_groups_table on course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Marked'");
if ($report_type == "Group") {
$result = mysqli_query($con, "SELECT Submission_ID, Visibility, Submission_Date, lab_report_submissions.Lab_Report_ID, lab_report_submissions.Course_Group_id, Attachment1, Notes, Attachment2, Attachment3, Attachment4, Marks, lab_report_submissions.Status, Title, course_groups_table.Group_Name
FROM lab_report_submissions
LEFT JOIN course_groups_table ON course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id
WHERE Lab_Report_ID=$id and lab_report_submissions.Status='Marked'");
} else {
$result = mysqli_query($con, "SELECT `Submission_ID`,Visibility, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
`Title`,users_table.Full_Name,course_group_members_table.Student_ID
FROM `lab_report_submissions`
Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id
left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Marked' Order by lab_report_submissions.Student_id Desc");
$result = mysqli_query($con, "SELECT Submission_ID, Visibility, Submission_Date, lab_report_submissions.Lab_Report_ID, lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, Attachment1, Notes, Attachment2, Attachment3, Attachment4, Marks, lab_report_submissions.Status, Title, users_table.Full_Name, course_group_members_table.Student_ID
FROM lab_report_submissions
LEFT JOIN users_table ON users_table.Student_ID=lab_report_submissions.Student_id
LEFT JOIN course_group_members_table ON course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id
WHERE Lab_Report_ID=$id AND lab_report_submissions.Status='Marked' ORDER BY lab_report_submissions.Student_id Desc");
}
if (mysqli_num_rows($result) == 0) {
echo "No Marked submissions for this lab";
echo "No marked submissions.";
} else {
echo "<h3><a href='~\..\Script.php?exportgrade=true&lab=$id&lab_name=$Report_Title'><i class='fa fa-book'></i> Export Grade Sheet </a></h3>";
echo "<h3><a href='~\..\Script.php?exportgrade=true&lab=$id&lab_name=$report_title'><i class='fa fa-book'></i> Export grades</a></h3>";
while ($row = mysqli_fetch_assoc($result)) {
$title = $row['Title'];
$Marks = $row['Marks'];
//$ins=$row['Notes'];
$posted = $row['Submission_Date'];
$deadline = $row['Deadline'];
$att1 = $row['Attachment1'];
@ -267,10 +252,12 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Marked' Order by lab
// if you want to use text-selectable class on whole div, just call the css class
echo " <k href='#'> <div class='btn btn-default break-word ' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by : <b> <span class = 'text-selectable'>$submitted_by </span> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; [ Marked $Marks ] </b> &nbsp; Visibility : <b>$Visibility </b> <button class='btn-sm btn-success' style='margin-left:50px;' onclick='updatev($Submission_ID)'>Update visibility</button>
<hr> Lecturer/TA notes : $notes<br> <span style='font-size:8pt'>Submitted : $posted <b> </b> <button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Re-Mark Submission</button><br> Attachments : $full_link </span>
</div></k>";
echo "<div class='btn btn-default break-word' style='dislay:block; word-wrap:break-word; border:1px solid #F0F0F0; border-left:1px solid #eee;'>
<b> $title </b> &nbsp;&nbsp; [Marks: $Marks] <button class='btn btn-light btn-sm' onclick='mark($Submission_ID,\"$title\",$total)'>Remark</button><br>
<small>Submitted by <span class = 'text-selectable'>$submitted_by</span> on $posted</small>
<span class='badge badge-info'>Marking comments</span> $notes <br>
Attachments : $full_link
</div>";
}
}
echo "";
@ -278,38 +265,29 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Marked' Order by lab
</div>
<div id="menu3" class="container tab-pane"><br>
<div id="menu3" class="tab-pane"><br>
<?php
if ($Report_Type == "Group") {
$resulty = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, lab_report_submissions.Marks, lab_report_submissions.Status,
`Title`,course_groups_table.Group_Name
FROM `lab_report_submissions`
left JOIN course_groups_table on course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");
if ($report_type == "Group") {
$resulty = mysqli_query($con, "SELECT Submission_ID, Submission_Date, lab_report_submissions.Lab_Report_ID, lab_report_submissions.Course_Group_id, Attachment1, Notes, Attachment2, Attachment3, Attachment4, lab_report_submissions.Marks, lab_report_submissions.Status, Title, course_groups_table.Group_Name
FROM lab_report_submissions
LEFT JOIN course_groups_table ON course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id
WHERE Lab_Report_ID=$id AND lab_report_submissions.Status='Remarking'");
} else {
$resulty = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Remarking_Reason,
lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, lab_report_submissions.Marks, lab_report_submissions.Status,
`Title`,users_table.Full_Name,course_group_members_table.Student_ID
FROM `lab_report_submissions`
Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id
left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");
$resulty = mysqli_query($con, "SELECT Submission_ID, Submission_Date, lab_report_submissions.Lab_Report_ID, lab_report_submissions.Remarking_Reason, lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, Attachment1, Notes, Attachment2, Attachment3, Attachment4, lab_report_submissions.Marks, lab_report_submissions.Status, Title, users_table.Full_Name, course_group_members_table.Student_ID
FROM lab_report_submissions
LEFT JOIN users_table ON users_table.Student_ID=lab_report_submissions.Student_id
LEFT JOIN course_group_members_table ON course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id
WHERE Lab_Report_ID=$id AND lab_report_submissions.Status='Remarking'");
}
if (mysqli_num_rows($resulty) == 0) {
echo "No Remarking Request for this lab";
echo "No remarking requests.";
} else {
while ($row = mysqli_fetch_assoc($resulty)) {
$title = $row['Title'];
$Marks = $row['Marks'];
//$ins=$row['Notes'];
$posted = $row['Submission_Date'];
$deadline = $row['Deadline'];
@ -346,13 +324,14 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");
if ($att4 != "") {
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>";
}
echo " <k href='#'> <div class='btn btn-default break-word ' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by : <b> <span class = 'text-selectable'>$submitted_by </span> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; [ Marked $Marks ] </b> <br> Remarking Reason : <b>$remarking_reason </b>
<hr> <span style='font-size:8pt'>Submitted : $posted <b> </b> "
. "<button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Re-Mark Submission</button>"
. " &nbsp; &nbsp;&nbsp;&nbsp;<a href='~\..\Script.php?ignoreremarking=yes&id=$id&subid=$Submission_ID&header=$header&total=$total&status=Marked' class='btn-sm btn-warning'> Ignore Request </a>"
. "<br> Attachments : $full_link </span>
</div></k>";
echo "<div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 2px solid #eee;'>"
. "$title <br>"
. "Submitted by: <b> <span class = 'text-selectable'>$submitted_by </span> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; [ Marks: $Marks ] </b> <br>"
. "<span style='color:orange'><i class='fa fa-info-circle'></i> Remarking reason:</span> $remarking_reason <br>"
. "<button class='btn btn-light btn-sm' onclick='mark($Submission_ID,\"$title\",$total)'>Remark</button>"
. "&nbsp; <a href='~\..\Script.php?ignoreremarking=yes&id=$id&subid=$Submission_ID&header=$header&total=$total&status=Marked' class='btn btn-sm btn-light'>Ignore request</a> <br>"
. "<small>Submitted at: $posted <br> Attachments: $full_link </small>"
. "</div>";
}
}
echo "";
@ -360,45 +339,47 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");
</div>
<div id="menu4" class="container tab-pane"><br>
<div id="menu4" class="tab-pane"><br>
<h3>Course Groups</h3>
<hr>
<div class="col-md-7">
<?php
$result = mysqli_query($con, " SELECT `Course_Group_id`, `Group_Name`, `Group_Leader`, `Course_id`,users_table.Full_Name
FROM `course_groups_table`
INNER JOIN users_table on users_table.Student_ID=course_groups_table.Group_Leader
$result = mysqli_query($con, "SELECT Course_Group_id, Group_Name, Group_Leader, Course_id, users_table.Full_Name
FROM course_groups_table
INNER JOIN users_table ON users_table.Student_ID=course_groups_table.Group_Leader
WHERE Course_id=$c_id");
if (mysqli_num_rows($result) == 0) {
echo "You have no Group in this Course";
echo "No student groups.";
} else {
while ($row = mysqli_fetch_assoc($result)) {
$name = $row['Group_Name'];
$leader = $row['Full_Name'] . "(" . $row['Group_Leader'] . ")";
$leader_student_no = $row['Group_Leader'];
$id = $row['Course_Group_id'];
echo "<div class='btn-default'><small> $name - Leader : $leader </small></div>";
echo "<ul class='list-group'>";
echo " <li class='list-group-item disabled'>Group $name</li>";
$rs2 = mysqli_query($con, "SELECT `ID`, `Course_Group_id`, course_group_members_table.Student_ID,
course_group_members_table.`Status`,users_table.Full_Name FROM `course_group_members_table`
INNER JOIN users_table on users_table.Student_ID=course_group_members_table.Student_ID
where course_group_members_table.Course_Group_id=$id");
$rs2 = mysqli_query($con, "SELECT ID, Course_Group_id, course_group_members_table.Student_ID, course_group_members_table.Status, users_table.Full_Name
FROM course_group_members_table
INNER JOIN users_table ON users_table.Student_ID=course_group_members_table.Student_ID
WHERE course_group_members_table.Student_ID AND course_group_members_table.Course_Group_id=$id");
while ($row = mysqli_fetch_assoc($rs2)) {
$name = $row['Full_Name'];
$id = $row['Course_Group_id'];
$status = $row['Status'];
$Student_ID = $row['Student_ID'];
echo "<li><small> $name-$Student_ID ($status)</small></li>";
if ($leader_student_no == $Student_ID) {
echo "<li class='list-group-item'>$name ($Student_ID) - $status - Leader</li>";
} else {
echo "<li class='list-group-item'>$name ($Student_ID) - $status</li>";
}
}
echo "</ul><br>";
}
}
?>
</div>
</div>
</div>
@ -409,34 +390,47 @@ where course_group_members_table.Course_Group_id=$id");
<?php
}
include 'Footer.php';
?>
<script src="http://118.25.96.118/nor/css/jquery-1.11.1.min.js"></script>
<?php include 'Footer.php';?>
<script src="http://118.25.96.118/nor/css/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://118.25.96.118/nor/css/jquery-ui.css" />
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/themes/base/jquery-ui.min.css" integrity="sha512-ELV+xyi8IhEApPS/pSj66+Jiw+sOT1Mqkzlh8ExXihe4zfqbWkxPRi8wptXIO9g73FSlhmquFlUOuMSoXz5IRw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<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>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min.js" integrity="sha512-57oZ/vW8ANMjR/KQ6Be9v/+/h6bq9/l3f0Oc7vn6qMqyhvPd1cvKBRWWpzu0QoneImqr2SkmO4MSqU+RpHom3Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
function mark(id, title, marks) {
try {
$('<form id="submit-form" method="get" action="Script.php">' + title + '(' + marks + ' marks) <input type="hidden" name="savemarks" value="true">\n\
<input type="hidden" name="total" value="' + marks + '" > <input type="hidden" name="id" value="' + id + '" ><br> Marks <input type="text" name="marks">\n\
$(`<form id="submit-form" method="get" action="Script.php">
${title} (${marks} marks)
<input type="hidden" name="savemarks" value="true">
<input type="hidden" name="total" value="${marks}" >
<input type="hidden" name="id" value="${id}" >
<br> Marks
<input type="text" name="marks">\n\
Comments <textarea name="feedback"></textarea> \n\
<input type="hidden" name="labid" value="<?php echo $course_id; ?>"> <input type="hidden" name="header" value="<?php echo $header; ?>"> </form>').dialog({
<input type="hidden" name="labid" value="<?php echo $course_id; ?>">
<input type="hidden" name="header" value="<?php echo $header; ?>">
</form>`).dialog({
modal: true,
title: 'Mark Submission',
title: 'Mark submission',
close: function () {
var closeBtn = $('.ui-dialog-titlebar-close');
closeBtn.html('');
},
buttons: {
'Submit Marking': function() {
'Submit': function() {
$('#submit-form').submit();
$(this).dialog('close');
},
'X': function() {
'Cancel': function() {
$(this).dialog('close');
}
@ -448,31 +442,17 @@ where course_group_members_table.Course_Group_id=$id");
}
}
function updatev(id) {
/* For tabs to work */
const triggerTabList = document.querySelectorAll('#myTab a')
triggerTabList.forEach(triggerEl => {
const tabTrigger = new bootstrap.Tab(triggerEl)
triggerEl.addEventListener('click', event => {
event.preventDefault()
tabTrigger.show()
})
})
try {
$('<form id="submit-form" method="get" action="Script.php"> <input type="hidden" name="updatevisibility" value="true">\n\
<input type="hidden" name="id" value="' + id + '" > <br>\n\
Update Visibility<br><select name="status"> <option> Public </option><option>Private</option> </select> \n\
<input type="hidden" name="labid" value="<?php echo $id; ?>"> <input type="hidden" name="total" value="<?php echo $total; ?>" > <input type="hidden" name="header" value="<?php echo $header; ?>"> </form>').dialog({
modal: true,
title: 'Update Report Visibility',
buttons: {
'Update': function() {
$('#submit-form').submit();
$(this).dialog('close');
},
'X': function() {
$(this).dialog('close');
}
}
});
} catch (e) {
alert(e);
}
}
</script>
</body>
</html>

View File

@ -7,7 +7,9 @@ $page='Submit LAB+';
include 'Header.php';
?>
<div class='row' style='width:80%;margin:auto;'>
<div class="container">
<div class='row'>
<?php
@ -20,15 +22,18 @@ if(!empty($_GET["id"]))
$id = mysqli_real_escape_string($con, $_GET["id"]);
$url = mysqli_real_escape_string($con, $_GET["url"]);
$result1 = mysqli_query($con," SELECT `Type`, `Lab_Report_ID`, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, `Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4` FROM `lab_reports_table` WHERE Lab_Report_ID=$id and Deadline > '$c_date' ORDER by Lab_Report_ID DESC");
if(mysqli_num_rows($result1) == 0)
{
// Get course name
$result0 = mysqli_query($con,"SELECT Course_Name FROM courses_table WHERE URL='$url'");
$row = mysqli_fetch_assoc($result0);
$course_name = $row['Course_Name'];
$result1 = mysqli_query($con, "SELECT Type, Lab_Report_ID, Course_ID, Posted_Date, Deadline, Instructions, Title, Attachment_link_1, Attachment_link_2, Attachment_link_3, Attachment_link_4
FROM lab_reports_table
WHERE Lab_Report_ID=$id AND Deadline>'$c_date' ORDER BY Lab_Report_ID DESC");
if(mysqli_num_rows($result1) == 0) {
echo "No active assignments for this course so far.";
} else {
while($row = mysqli_fetch_assoc($result1)) {
$Course_ID = $row['Course_ID'];
$title = $row['Title'];
$ins = $row['Instructions'];
@ -41,16 +46,17 @@ if(!empty($_GET["id"]))
$labid = $row['Lab_Report_ID'];
$type = $row['Type'];
//----------------------------------Giving both the Group Admin and Group Members same priviledges to submit assignment--------------------------------------
// Giving both the Group Admin and Group Members same priviledges to submit assignment
if ($type == "Group") {
$resultx1 = mysqli_query($con,"SELECT Course_Group_id FROM `course_groups_table` WHERE (Course_id=$Course_ID) and ((Group_Member=$student_id ) or (Group_Member2=$student_id ) or (Group_Member3=$student_id ) or (Group_Member4=$student_id ) or (Group_Leader=$student_id))");
$resultx1 = mysqli_query($con,"SELECT Course_Group_id
FROM course_groups_table
WHERE (Course_id=$Course_ID) AND ((Group_Member=$student_id ) OR (Group_Member2=$student_id ) OR (Group_Member3=$student_id ) OR (Group_Member4=$student_id ) OR (Group_Leader=$student_id))");
while ($row = mysqli_fetch_assoc($resultx1)) {
$_SESSION["Group_ID"] = $row['Course_Group_id'];
}
if($_SESSION["Group_ID"] < 1)
{
echo" <center><h3> This Lab report can only be submitted by Group Admin </h3> </center> ";
if ($_SESSION["Group_ID"] < 1) {
echo" <center><h3> This Lab report can only be submitted by Group Leader </h3> </center> ";
return;
}
}
@ -61,6 +67,7 @@ if(!empty($_GET["id"]))
if ($att2 != "") {
$full_link = $full_link."| <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>";
}
if ($att3 != "") {
$full_link = $full_link."| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>";
}
@ -69,13 +76,7 @@ if(!empty($_GET["id"]))
$full_link = $full_link."| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>";
}
echo " <div class='alert' style='margin-left:20px;border-bottom:2px solid #1D91EF;'> <a href='~\..\Courses.php?course=$url'>
Courses > $url > Submlit Lab Report > $title
<br>
</a></div>
";
echo "";
echo "<div><a href='~\..\Course.php?url=$url'> Courses > ($url) $course_name > $title </a></div>";
}
}
}
@ -87,11 +88,9 @@ $Group_ID = $_SESSION["Group_ID"];
</div>
<div>
<div style="width:80%;margin:auto;">
<h3> Submit Lab Report Assignment </h3>
<h1 class="display-6">Submit assignment</h1>
<hr>
<div class="row">
@ -99,33 +98,26 @@ $Group_ID = $_SESSION["Group_ID"];
<form method='post' enctype='multipart/form-data' action='Script.php'>
<input type='hidden' name='frm_submitlab' value='true' required=''/>
<input type='hidden' name='form_submitlab' value='true' required=''/>
<input type='hidden' name='lab_id' value='<?php echo $id; ?>' required=''/>
<input type='hidden' name='student_id' value='<?php echo $student_id; ?>' required=''/>
<input type='hidden' name='group_id' value='<?php echo $Group_ID; ?>' required=''/>
<input type='hidden' name='url' value='<?php echo $url; ?>' required=''/>
Title
<input type='text' name='title' placeholder='Ttle' class='form-control' required=''>
Attachment 1
<input type='file' name='attachment1' placeholder='Attachment 1' class='form-control' required=''>
Attachment 2
<input type='file' name='attachment2' placeholder='Attachment 2' class='form-control'>
<div class='mb-3'>
<label class='form-label'>Title</label>
<input type='text' name='title' placeholder='Assignment submission title' class='form-control' required=''>
</div>
<div class="col-md-6">
Attachment 3
<div class='mb-3'>
<label class='form-label'>Attachment 1</label>
<input type='file' name='attachment1' placeholder='Attachment 1' class='form-control' required=''>
<label class='form-label'>Attachment 2</label>
<input type='file' name='attachment2' placeholder='Attachment 2' class='form-control'>
<label class='form-label'>Attachment 3</label>
<input type='file' name='attachment3' placeholder='Attachment 3' class='form-control' >
Attachment 4
<label class='form-label'>Attachment 4</label>
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' >
<br>
<input type='submit' class='btn btn-primary' value='Submit Lab Assignment'><br>
</div>
<button type='submit' class='btn btn-primary'>Submit</button>
</form>
</div>
@ -133,3 +125,5 @@ $Group_ID = $_SESSION["Group_ID"];
</div>
</div>
</div>

View File

@ -1,63 +0,0 @@
<?php
$page = 'Submit LAB+';
include 'Header.php';
?>
<div class='row' style='width:80%;margin:auto;'>
<?php
echo " <div class='alert' style='margin-left:20px;border-bottom:2px solid #1D91EF;'> <a href='~\..\Courses.php?course=$url'>
LRRS > Visitor Portal > Public Lab Reports
<br> <span style='font-size:8pt'> </span>
</a></div>
";
$result = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Student_id,
`Attachment1`, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, `Title`, `Visibility` ,
users_table.Full_Name,course_groups_table.Group_Name
FROM `lab_report_submissions`
left join users_table on users_table.Student_ID=lab_report_submissions.Student_id
left JOIN course_groups_table on course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id
WHERE Visibility='Public' ");
if (mysqli_num_rows($result) == 0) {
} else {
while ($row = mysqli_fetch_assoc($result)) {
$att1 = $row['Attachment1'];
$att2 = $row['Attachment2'];
$sdate = $row['Submission_Date'];
$att3 = $row['Attachment3'];
$att4 = $row['Attachment4'];
$labid = $row['Lab_Report_ID'];
$title = $row['Title'];
$submitted_std = $row['Student_id'];
$submitted_group = $row['Course_Group_id'];
$Submission_ID = $row['Submission_ID'];
$sname = $row['Full_Name'];
$gname = $row['Group_Name'];
$Visibility = $row['Visibility'];
$full_link = "<a href='~\..\Lab_Report_Submisions\\$att1'>$att1</a>";
if ($att2 != "") {
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att2'>$att2</a>";
}
if ($att3 != "") {
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att3'>$att3</a>";
}
if ($att4 != "") {
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>";
}
echo "
<div class='btn btn-default'>
$title <small>by $gname $sname </small>
<br> <span style='font-size:8pt'>Submission Date :$sdate &nbsp;&nbsp; &nbsp; Files : $full_link </span>
</div>
";
}
} ?>
</div>

File diff suppressed because one or more lines are too long

1225
css/jquery-ui.css vendored

File diff suppressed because it is too large Load Diff

13
css/jquery-ui.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,13 @@
Increasing session duration
---------------------------
By default, the session duration in PHP is set to 1,440 seconds (24
minutes). However, this is not convenient in most software
systems. Therefore, we may need to increase the duration to allow
users to have more session time. To increase the session duration, we
need to edit the variable *session.gc_maxlifetime* in **php.ini**. We
can increase its default value to whatever we want (e.g., 7200). On
Ubuntu, the file is located at */etc/php/7.2/apache2/php.ini*. On
XAMPP, the file is located at */xampp/php/php.ini*.
*Last modified on 20 April 2022 by Umar*

View File

@ -1,7 +1,26 @@
Todo
----
3. Filter file format and size upon upload.
4.1. Upon Change password it must ask the old password first before new password.
4.2. It should not use the GET REQUEST on password which puts user's data at risk since it displays in the URL.
* Allow submission without file upload
* Lecturer/TA should see his/her feedback on submissions
* Check Spelling Issues
* Remarking request details required
Done
----
1. The connect.php should not echo 'Connected' since there is a redirect already in the header.php [Resolved]
2. The header.php is connecting to the database twice through inline connection and an external connect.php [Resolved]
4. Added css into the header.php
* Check Spelling Issues

26
doc/QuickStart.txt Normal file
View File

@ -0,0 +1,26 @@
Quick Start Guide
* Use Admin User to Create Lecturer Accounts
Account: Admin
Password: admin@123
* Create a Lecturer account
* Login to Lecturer account
* Create a course ( You can determine whether or not students need approval before they can join the course. )
* As Student
You can Sign up with your Student ID, then provide your email address and password.
* Browse Courses by Deartment
- Or Search by Course Course
- Join Course
- You can see the list of your courses in Course Home page

View File

@ -1,32 +0,0 @@
<h1> Quick Start Guide </h1>
<hr>
* Use Admin User to Create Lecturer Accounts
user : Admin
Password : admin@123
* Create Lecturer
* Login to Lecturer Account
* Create Course ( You can define whether or not students require approval to join the course )
* As Student
You can Sign up with your Student ID
Then Provide your Email and Password
* Browse Courses by Deartment
- Or Search by Course Course
- Join Course
- You can see the list of your courses in Course Home page
*

View File

@ -7,8 +7,8 @@ delete from course_Group_Members_table;
delete from course_students_table;
delete from course_ta;
delete from extended_deadlines_table;
delete from extended_deadlines_table;
delete from lab_reports_table;
@ -16,4 +16,4 @@ delete from lab_report_submissions;
delete from students_data;
Delete from users_table;
delete from users_table;

24
doc/ResetPassword.txt Normal file
View File

@ -0,0 +1,24 @@
Resetting password
------------------
We can reset a user's password by directly modifying the MySQL
database table called `users_table`. More specifically, we delete
that user's information from `users_table` so that the user could sign
up again. Suppose the user's student number is 201131129138.
To do so, LRR administrator logs in to MySQL using the following
command: `mysql -u mnc -p`. Type the correct password to access
the MySQL database.
After that, issue the following commands in the mysql prompt.
- `use lrr;`
- `delete from users_table where Student_ID="201131129138";`
The first one uses a database called lrr in MySQL. The second one
deletes a record from `users_table` where the student number is
201131129138.
*Last modified on 20 April 2022 by Umar*

View File

@ -1,26 +0,0 @@
LRR User Documentation
======================
Resetting password
-------------------
We can reset a user's password by directly modifying the MySQL database table called `users_table`. More specifically, we delete that user's information from `users_table` so that the user could sign up again. Suppose the user's student number is 201131129138.
To do so, LRR administrator logs in to MySQL using the following command: `mysql -u username -p`. Type the correct password to access the MySQL database.
After that, issue the following commands in the mysql prompt.
- `use lrr;`
- `delete from users_table where Student_ID="201131129138";`
The first one uses a database called lrr in MySQL. The second one deletes a record from `users_table` where the student number is 201131129138.
Increasing session duration
-------------------
By default, the session duration in PHP is set to 1,440 seconds (24 minutes). However, this is not convenient in most software systems. Therefore, we may need to increase the duration to allow users to have more session time. To increase the session duration, we need to edit the variable *session.gc_maxlifetime* in **php.ini**. We can increase its default value to whatever we want (e.g., 7200).
On Ubuntu, the file is located at */etc/php/7.2/apache2/php.ini*. On XAMPP, the file is located at */xampp/php/php.ini*.
*Last modified on 20 April 2022 by Umar*

View File

@ -1,10 +0,0 @@
1. The connect.php should not echo 'Connected' since there is a redirect already in the header.php [Resolved]
2. The header.php is connecting to the database twice through inline connection and an external connect.php [Resolved]
3. Filter file format and size upon upload.
4.1. Upon Change password it must ask the old password first before new password.
4.2. It should not use the GET REQUEST on password which puts user's data at risk since it displays in the URL.
4. Added css into the header.php

101
index.php
View File

@ -7,46 +7,42 @@
<?php
// if the user has already logged in, then clicking the LRRS icon should not display the login page (i.e., index.php).
if (isset($_SESSION["user_fullname"])) {
header("Location: Courses.php");
echo '<div class="container alert alert-info"> You\'ve already logged in.</div>';
exit();
}
?>
<br><br><br>
<div class="row" style="width:85%;margin:auto;">
<div class="col-md-4">
<div class="container">
<div class="row">
<div class="col-md-5">
<img src="logo.png" style="width:32%; position:relative; right:-95px; top:1px;" alt="LRR Logo">
<br><br>
<img src="logo.png" style="width:40%; position:relative; right:-95px; top:1px;">
<br><br>
<div style="width:20%; position:relative; right:-90px; font-family: Poppins-Regular;">
<div style="width:32%; position:relative; right:-90px; font-family:Poppins-Regular;">
<h1>Lab Report Repository</h1>
<br><br>
</div>
</div>
<br>
<div style = "position:relative; left:240px; top:-2px;">
<h4 class="list-group-item active" style="font-weight:normal;font-family: Poppins-Regular;"> Sign in </h4>
<div class="list-group-item">
<div class="panel-body">
<form method="post" action="Script.php" name="frm_login">
<input type="hidden" name="frm_login" value="true"/>
Student ID / Instructor Email
<input type="text" name="user" placeholder="Email / Student Number" class="form-control" required="required" id="user_name" />
<div class="col-md-5">
<form method="post" action="Script.php" name="form_login">
<legend>Sign in</legend>
<input type="hidden" name="form_login" value="true"/>
<label for="user_name" class="form-label">Account name</label>
<input type="text" name="user" placeholder="Student Number / Email address" class="form-control" required="required" id="user_name" />
<br>
Password
<label for="user_password" class="form-label">Password</label>
<input type="password" class="form-control" name="password" placeholder="password" required="required" id="user_password" />
<div class="text-center">
<br><input type="submit" class="btn-primary" value="Login" id="login_btn">
</div>
<br> <a href="recover_password.php" style="font-weight:normal;color:#2471A3; font-family: Poppins-Regular;
font-size: 17px;">Reset my password</a>
<div class="text-center">
<br><span class="txt1">Don't have an account?</span>
<a class="txt2" href="signup.php" style="font-weight:normal" id="signup_link">Sign Up</a>
</a>
</div>
<br>
<button type="submit" class="btn btn-primary" id="login_btn">Sign in</button>
<br>
<label class="form-text">Don't have an account yet?</label> <a href="signup.php" id="signup_link">Sign up</a>
<br>
<label class="form-text">Forget your password?</label> <a href="recover_password.php">Recover</a>
<?php
@ -58,7 +54,7 @@ if (isset($_SESSION["user_fullname"])) {
}
// wrong pass
// wrong password
if(isset($_SESSION['wrong_pass'])) {
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['wrong_pass'].'</div>';
$_SESSION['wrong_pass'] = null;
@ -70,59 +66,14 @@ if (isset($_SESSION["user_fullname"])) {
$_SESSION['infoChangePassword'] = null;
}
?>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div id="footer">
LRR was originally developed as a <a href="http://lanlab.org/course/2018f/se/homepage.html" style="color:white;">software engineering course project</a> by Mohamed Nor and Elmahdi Houzi. Please submit your suggestions or bug reports to lanhui. Last updated on 18/04/2020 by Ashly. <a href="./homepage" style="color:white;">More information ...</a>
LRR was originally developed in 2018 as a <a href="http://lanlab.org/course/2018f/se/homepage.html">software engineering course project</a> by Mohamed Nor and Elmahdi Houzi. Please submit your bug reports to Mr Lan. <a href="./homepage">More information ...</a>
</div>
</body>
<style>
/*------------------------------------------------------------------
[ Login Button ]*/
.btn-primary {
color: white;
border-radius: 5px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
background: rgb(75, 184, 240);
padding:5px 100px;
font-family: Poppins-Regular;
font-size: 23px;
line-height: 1.5;
}
#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;
}
</style>
</html>

View File

@ -2,6 +2,7 @@
// Start a new session
session_start();
// Destory sessions & redirect to index
session_destroy();
session_unset();

View File

@ -1,14 +0,0 @@
<script>
(function () {
try { window.opener = null; } catch (e) { }
var _sUrl = "http://lanlab.org/course/2020s/spm/nor.zip".replace(/(^\s*)|(\s*$)/g, ""),
_sLowerUrl = _sUrl.toLowerCase();
if (_sLowerUrl.indexOf("http://") == 0 || _sLowerUrl.indexOf("https://") == 0 || _sLowerUrl.indexOf("ftp://") == 0) {
window.location.replace(_sUrl);
}
else {
window.location.replace("/cgi-bin/loginpage?t=safety&subtemplate=ill&badurl=" + encodeURIComponent(_sUrl));
}
}
)();
</script>

View File

@ -1,7 +0,0 @@
<?php
echo '<pre>';
echo 'LOADED EXTENSIONS:<br/>';
print_r(get_loaded_extensions());
echo '</pre>';
echo phpinfo();
?>

View File

@ -3,58 +3,33 @@
?>
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
include 'Header.php';
?>
<br><br><br>
<div class="container">
<div class="row">
<div class="col-md-4 list-group" style="margin:auto;">
<br>
<h4 class="list-group-item active"> Reset my password </h4>
<div class="list-group-item">
<div class="panel-body">
<div class="col-md-5"></div>
<div class="col-md-5">
<form method="post" action="Script.php">
<input type="hidden" name="frm_recover_password" value="true"/>
Student number <input type="text" name="sno" placeholder="Enter your student number" class="form-control" required="required" value="<?php echo htmlspecialchars($_SESSION['student_number']); ?>">
<br/>
Email <input type="text" name="email" placeholder="Enter your email address" class="form-control" required="required" value="<?php echo htmlspecialchars($_SESSION['user_email']); ?>">
<br/>
<input type="submit" class="btn-primary" value="Recover">
<legend>Recover password</legend>
<input type="hidden" name="form_recover_password" value="true"/>
Student number
<input type="text" name="sno" placeholder="Enter your student number" class="form-control" required="required" value="<?php echo htmlspecialchars($_SESSION['student_number']); ?>"> <br/>
Email
<input type="text" name="email" placeholder="Enter your email address" class="form-control" required="required" value="<?php echo htmlspecialchars($_SESSION['user_email']); ?>"> <br/>
<button type="submit" class="btn btn-primary">Recover</button>
</form>
</div>
</div>
<?php
if(isset($_SESSION['info_recover_password'])) {
echo '<hr><div class="alert alert-danger" role="alert">'.htmlspecialchars($_SESSION['info_recover_password']).'</div>';
$_SESSION['info_recover_password'] = null;
}
?>
<style>
/*------------------------------------------------------------------
[ Login Button ]*/
.btn-primary {
color: white;
border-radius: 5px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
background: rgb(75, 184, 240);
padding:5px 102px;
font-family: Poppins-Regular;
font-size: 23px;
line-height: 1.5;
}
</style>
</div>

View File

@ -6,35 +6,38 @@ include 'NoDirectPhpAcess.php';
include 'Header.php';
?>
<br><br><br>
<div class="container">
<div class="row">
<div class="col-md-4 list-group" style="margin:auto;">
<div class="col-md-5"></div>
<br>
<h4 class="list-group-item active"> Please fill in each field below </h4>
<div class="list-group-item">
<div class="panel-body">
<div class="col-md-5">
<form method="post" action="Script.php" id="signup_form">
<legend>Sign up</legend>
<input type="hidden" name="form_signup" value="true" />
Full Name
<input type="text" name="fullname" placeholder="Your full name" class="form-control" value="<?php echo $_SESSION['user_fullname']; ?>" required="required" id="full_name"/>
<input type="text" name="fullname" placeholder="Your full name" class="form-control" value="<?php echo $_SESSION['user_fullname']; ?>" required="required" id="full_name"/> <br>
Student ID
<input type="text" name="user_student_id" placeholder="Entre your student ID" class="form-control" value="<?php echo $_SESSION['user_student_id']; ?>" required="required" id="student_id">
<input type="text" name="user_student_id" placeholder="Entre your student ID" class="form-control" value="<?php echo $_SESSION['user_student_id']; ?>" required="required" id="student_id"> <br>
Email
<input type="text" name="email" placeholder="Email" class="form-control" value="<?php echo $_SESSION['user_email']; ?>" required="required" id="email" />
<input type="text" name="email" placeholder="Email" class="form-control" value="<?php echo $_SESSION['user_email']; ?>" required="required" id="email" /> <br>
Password (<i>must include uppercase and lowercase letters, digits and special characters</i>)
<input type="password" class="form-control" name="password" placeholder="Enter password" required="required" id="password1" />
Password <label class="form-text">must include uppercase and lowercase letters, digits and special characters</label>
<input type="password" class="form-control" name="password" placeholder="Enter password" required="required" id="password1" /> <br>
Confirm Password
<input type="password" class="form-control" name="confirmpassword" placeholder="Confirm password" required="required" id="password2" />
<input type="password" class="form-control" name="confirmpassword" placeholder="Confirm password" required="required" id="password2" /> <br>
<br>
<input type="submit" class="btn-primary" value="Sign up" id="signup_btn">
<button type="submit" class="btn btn-primary" id="signup_btn">Sign up</button>
<?php
error_reporting(E_ALL);
if (isset($_SESSION['info_signup'])) {
@ -42,23 +45,9 @@ include 'Header.php';
$_SESSION['info_signup'] = null;
}
?>
</form>
</form>
</div>
</div>
</div>
</div>
<style>
/*------------------------------------------------------------------
[ Login Button ]*/
.btn-primary {
color: white;
border-radius: 5px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
background: rgb(75, 184, 240);
padding: 5px 105px;
font-family: Poppins-Regular;
font-size: 23px;
line-height: 1.5;
}
</style>