(1) Make php files look better; (2) Removed Visitors.php and Reset_password.php because they are no longer used; (3) TODO: review Submissions.php, Script.php, Course.php and Courses.php.

Bug430-Eden2
Lan Hui 2023-08-01 17:02:33 +08:00
parent 975cdfec63
commit a56b4c00dd
13 changed files with 899 additions and 1067 deletions

View File

@ -16,33 +16,20 @@ 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>
<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
<!-- <?php
if ($_SESSION['user_type'] == "Lecturer") {
echo " <h4> TA Account Management </h4>
<hr> " ;
echo " <h4> TA Account Management </h4> <hr> " ;
echo "<b>TA Accounts </b><br>" ;
}
else if($_SESSION['user_type'] == "Admin"){
@ -51,7 +38,7 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
echo "<b>Lecturer Accounts </b><br>";
}
?>
?> -->
<div class="container">
@ -59,15 +46,15 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#home">Create New Account</a>
<a class="nav-link active" data-toggle="tab" href="#home">Create TA account</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" data-toggle="tab" href="#menu1" id="batch_tab">Batch create student accounts</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" data-toggle="tab" href="#menu2" id="existing_accounts_tab">Existing accounts</a>
</li>
</ul>
@ -136,7 +123,20 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
</div>
<div id="menu1" class="container tab-pane fade"><br>
<!-- code contributed by Xu Xiaopeng (https://github.com/xxp1999) -->
<div id="menu1" 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="70" rows="16" name="users" required=""></textarea>
</p>
<input type="submit" class="btn btn-primary" value="Register students" id="register_btn"><br>
</form>
</div>
<div id="menu2" class="container tab-pane fade"><br>
<table class="table-bordered" style="font-size: 10pt;">
<tr style="font-size:10pt;">
@ -144,7 +144,7 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
<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,20 +153,20 @@ 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-warning' onclick=\"updatePass(" . $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>";
@ -182,18 +182,6 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
</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>
@ -202,21 +190,17 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
<div class="col-md-6">
<div class="container">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<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" data-toggle="tab" href="#menu3" id="existing_courses">Existing courses</a>
</li>
</ul>
<!-- Tab panes -->
</div>
<div id="menub" class="container tab-pane active"><br>
<div id="menu3" class="container tab-pane active"><br>
<b> Existing Course Portals </b>
<b> Past courses </b>
<hr>
<table class="table-bordered" style="font-size: 10pt;">
<tr>
@ -227,7 +211,8 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
<th>Assign 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");
$user_id = $_SESSION['user_id'];
$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;");
if (mysqli_num_rows($result) == 0) {
} else {
$counter = 0;
@ -240,9 +225,7 @@ 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)) {
@ -252,7 +235,7 @@ where course_ta.Course_ID=$c_id");
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)) {
@ -277,7 +260,7 @@ where course_ta.Course_ID=$c_id");
<script>
function updatePass(id, pass) {
if (!confirm('Are you to Reset User Password')) {
if (!confirm('Are you sure to reset user password?')) {
return;
}
@ -285,7 +268,7 @@ 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;

View File

@ -168,7 +168,7 @@ if( $_SESSION['user_type'] == "Student")
}
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 ($type) <br> <span style='font-size:8pt'> $ins</span>
<br> <span style='font-size:8pt'>Posted : $posted &nbsp;&nbsp;&nbsp;&nbsp; Deadline : $deadline &nbsp;&nbsp;&nbsp;&nbsp;($Marks Marks) &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<a href='~\..\SubmitLab.php?id=$labid&url=$url' class='btn-sm btn-info' style='margin-left:50px;'> Submit Lab Report</a><br> Attachments : $full_link </span>
<br> <span style='font-size:8pt'>Posted : $posted &nbsp;&nbsp;&nbsp;&nbsp; Deadline : $deadline &nbsp;&nbsp;&nbsp;&nbsp;($Marks Marks) &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<a href='~\..\SubmitLab.php?id=$labid&url=$url' class='btn-sm btn-info' style='margin-left:50px;'>Submit</a><br> Attachments : $full_link </span>
</div></k>";
}}
@ -498,7 +498,7 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
while($row = mysqli_fetch_assoc($resultx1)) {$count_groups=$row['Course_Group_id'];}
echo " <button onclick='CreateGroup()' class='btn btn-primary'> Create Group</button>";
echo " <button onclick='CreateGroup()' class='btn btn-primary'>Create group</button>";
?>
@ -514,7 +514,7 @@ course_groups_table.Course_Group_id=course_group_members_table.Course_Group_id W
if(mysqli_num_rows($result)==0)
{
echo "You have no Group in this Course";
echo "You have no group in this course.";
} else { while($row = mysqli_fetch_assoc($result)) {
$name=$row['Group_Name'];
$id=$row['Course_Group_id'];

View File

@ -203,7 +203,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
?>
<h3> Post new Lab Assignment </a></h3>
<h3>New an assignment</h3>
<form method='post' enctype='multipart/form-data' action='Script.php'>
<?php
@ -213,7 +213,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
<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,9 +221,9 @@ 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'>
@ -238,11 +238,11 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
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
}
@ -251,7 +251,7 @@ 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"])){
@ -276,7 +276,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
if( $_SESSION['user_type']=="TA")
{
echo "<b style='color:gray'>*Only Lecturer can post a new lab report assignment</b><br>";
echo "<b style='color:gray'>Only Lecturer can post assignments.</b><br>";
}
if(mysqli_num_rows($result)==0)
{
@ -441,7 +441,7 @@ 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>";
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)) {
$id=$row['ID'];
@ -464,7 +464,7 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'"
<?php
if( $_SESSION['user_type']=="TA")
{
echo "<center>Only Lecturers can Post new Lab report Assignments</center>";
echo "<center>Only Lecturer can post assignments</center>";
}
if( $_SESSION['user_type']=="Lecturer"){ ?>
@ -473,16 +473,16 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'"
<form method="post" action="Script.php">
<input type="hidden" name="frm_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)
<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>
@ -492,7 +492,7 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'"
<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
@ -570,7 +570,7 @@ if( $_SESSION['user_type']=="Student")
if(mysqli_num_rows($result)==0)
{
echo "No results found for your Search <hr>";
echo "No results found ... <hr>";
} else {
@ -643,9 +643,9 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl
<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
<div class='row'><div class='col-md-5'> Find course by course code
<input type='text' class='form-control' name='search' maxlength='11' placeholder='Enter Course Code'>
</div><div class='col-md-6'>
</div><div class='col-md-5'>
List courses by faculty
<select name='faculty' class='form-control'>";

View File

@ -144,6 +144,10 @@ if (mysqli_connect_errno()) {
padding-bottom:1px;
}
.col-md-4 {
border-right: 1px solid skyblue;
}
</style>
</head>

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

@ -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

@ -87,11 +87,9 @@ $Group_ID = $_SESSION["Group_ID"];
</div>
<div style="width:80%;margin:auto;">
<h3> Submit Lab Report Assignment </h3>
<h3>Submit assignment</h3>
<hr>
<div class="row">
@ -114,9 +112,6 @@ $Group_ID = $_SESSION["Group_ID"];
Attachment 2
<input type='file' name='attachment2' placeholder='Attachment 2' class='form-control'>
</div>
<div class="col-md-6">
Attachment 3
<input type='file' name='attachment3' placeholder='Attachment 3' class='form-control' >
@ -125,7 +120,7 @@ $Group_ID = $_SESSION["Group_ID"];
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' >
<br>
<input type='submit' class='btn btn-primary' value='Submit Lab Assignment'><br>
<input type='submit' class='btn btn-primary' value='Submit'><br>
</form>
</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>

View File

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

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,15 +3,7 @@
?>
<?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';
?>
@ -21,7 +13,7 @@ include 'Header.php';
<br>
<h4 class="list-group-item active"> Reset my password </h4>
<h4 class="list-group-item active"> Reset password </h4>
<div class="list-group-item">
<div class="panel-body">
@ -32,7 +24,6 @@ include 'Header.php';
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">
</form>
<?php
@ -43,18 +34,10 @@ if(isset($_SESSION['info_recover_password'])) {
}
?>
</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 102px;
font-family: Poppins-Regular;
font-size: 23px;
line-height: 1.5;
}
</style>
</div>
</div>
</div>

View File

@ -48,17 +48,3 @@ include 'Header.php';
</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>