(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

395
Admin.php
View File

@ -16,278 +16,261 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
?> ?>
<style>
.col-md-4 {
border-right: 1px solid skyblue;
}
</style>
<br> <br>
<div style="width: 80%;margin: auto;"> <div style="width: 80%;margin: auto;">
<h2> Administration Panel </h2> <h2> Administration panel </h2>
</div> </div>
<hr> <hr>
<div class="row" style="width: 80%;margin: auto;"> <div class="row" style="width: 80%;margin: auto;">
<!--<h4>General system Settings</h4><hr> <div class="col-md-6">
<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") { if ($_SESSION['user_type'] == "Lecturer") {
echo " <h4> TA Account Management </h4> echo " <h4> TA Account Management </h4> <hr> " ;
<hr> " ; echo "<b>TA Accounts </b><br>" ;
echo "<b>TA Accounts </b><br>" ; }
} else if($_SESSION['user_type'] == "Admin"){
else if($_SESSION['user_type'] == "Admin"){ echo " <h4> Lecturer Account Management </h4>
echo " <h4> Lecturer Account Management </h4> <hr> ";
<hr> "; echo "<b>Lecturer Accounts </b><br>";
echo "<b>Lecturer Accounts </b><br>"; }
}
?> ?> -->
<div class="container"> <div class="container">
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
<li class="nav-item"> <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>
<li class="nav-item"> <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>
<li class="nav-item"> <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> </li>
</ul> </ul>
<!-- Tab panes --> <!-- Tab panes -->
<div class="tab-content"> <div class="tab-content">
<div id="home" class="container tab-pane active"><br> <div id="home" class="container tab-pane active"><br>
<?php <?php
if ($_SESSION['user_type'] == "Lecturer") { if ($_SESSION['user_type'] == "Lecturer") {
echo "<b>Create TA Accounts </b>"; echo "<b>Create TA Accounts </b>";
} }
else if($_SESSION['user_type'] == "Admin"){ else if($_SESSION['user_type'] == "Admin"){
echo "<b>Create Lecturer Accounts </b>"; echo "<b>Create Lecturer Accounts </b>";
} }
?> ?>
<form method="post" action="Script.php" id="create_account_form"> <form method="post" action="Script.php" id="create_account_form">
<input type="hidden" name="frm_createlecturrer" value="true" required="" /> <input type="hidden" name="frm_createlecturrer" value="true" required="" />
Full Name Full Name
<input type="text" name="fullname" placeholder="Full Name" class="form-control" required=""> <input type="text" name="fullname" placeholder="Full Name" class="form-control" required="">
Email Email
<input type="text" name="email" placeholder="Email / Student Number" class="form-control" required=""> <input type="text" name="email" placeholder="Email / Student Number" class="form-control" required="">
Passport Number / ID (Used as Initial Password) Passport Number / ID (Used as Initial Password)
<input type="text" class="form-control" name="passport" placeholder="Passport No./ID" required=""> <input type="text" class="form-control" name="passport" placeholder="Passport No./ID" required="">
<br> User Type : <br> User Type :
<?php <?php
if ($_SESSION['user_type'] == "Lecturer") { if ($_SESSION['user_type'] == "Lecturer") {
echo ' <input type="radio" name="type" value="TA" required="" id="role_TA"> TA (Teaching Assistant) '; 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 "; 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> <input type="submit" class="btn btn-primary" value="Create" id="create_btn"><br>
<?php <?php
error_reporting(E_ALL); error_reporting(E_ALL);
if (isset($_SESSION['info_Admin_Users'])) { if (isset($_SESSION['info_Admin_Users'])) {
echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Users'] . '</div>'; echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Users'] . '</div>';
$_SESSION['info_Admin_Users'] = null; $_SESSION['info_Admin_Users'] = null;
} }
if (isset($_SESSION['info_Admin_Users'])) { if (isset($_SESSION['info_Admin_Users'])) {
echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Users'] . '</div>'; echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Users'] . '</div>';
$_SESSION['info_Admin_Users'] = null; $_SESSION['info_Admin_Users'] = null;
} }
?> ?>
</form> </form>
<hr> <hr>
</div> </div>
<div id="menu1" class="container tab-pane fade"><br>
<table class="table-bordered" style="font-size: 10pt;"> <!-- code contributed by Xu Xiaopeng (https://github.com/xxp1999) -->
<tr style="font-size:10pt;"> <div id="menu1" class="container tab-pane fade" style="margin-top:10px">
<th>ID</th> <b>Separate two student numbers with a space</b><br>
<th>Name</th> <form action="batch_insert.php" method="post" id="batch_form">
<th>Email</th> <p>
<th>Passport / ID </th> <textarea cols="70" rows="16" name="users" required=""></textarea>
<th>Reset Password </th> </p>
<th>Block/Activate </th> <input type="submit" class="btn btn-primary" value="Register students" id="register_btn"><br>
</tr> </form>
<?php </div>
if ($_SESSION['user_type'] == "Lecturer") {
$result = mysqli_query( <div id="menu2" class="container tab-pane fade"><br>
$con,
"SELECT * FROM Users_Table WHERE UserType in ('TA')"
);
}
else if($_SESSION['user_type'] == "Admin"){ <table class="table-bordered" style="font-size: 10pt;">
$result = mysqli_query( <tr style="font-size:10pt;">
$con, <th>ID</th>
"SELECT * FROM Users_Table WHERE UserType in ('Lecturer')" <th>Name</th>
); <th>Email</th>
} <th>Passport / ID </th>
<th>Reset password </th>
<th>Block/Activate </th>
</tr>
<?php
while ($row = mysqli_fetch_assoc($result)) { if ($_SESSION['user_type'] == "Lecturer") {
$pass = $row['Passport_Number'];
$btn = "<button class='btn-primary' 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>";
} else {
$newstatus = "Active";
$btnBlock = "<button class='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>"; $result = mysqli_query(
} $con,
?> "SELECT * FROM users_table WHERE UserType in ('TA')"
</table> );
}
</div> else if ($_SESSION['user_type'] == "Admin"){
$result = mysqli_query(
$con,
"SELECT * FROM users_table WHERE UserType in ('Lecturer')"
);
}
<!-- code contributed by Xu Xiaopeng (https://github.com/xxp1999) --> while ($row = mysqli_fetch_assoc($result)) {
$pass = $row['Passport_Number'];
$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>";
} else {
$newstatus = "Active";
$btnBlock = "<button class='btn-success' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"activate_account_1\">Activate</button>";
}
<div id="menu2" class="container tab-pane fade" style="margin-top:10px"> 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>";
<b>Separate two student numbers with a space.</b><br> }
<form action="batch_insert.php" method="post" id="batch_form"> ?>
<p> </table>
<textarea cols="80" rows="16" name="users" required=""></textarea>
</p> </div>
<input type="submit" class="btn btn-primary" value="Register Students" id="register_btn"><br>
</form> </div>
</div> </div>
</div>
</div> </div>
</div> <div class="col-md-6">
<div class="col-md-6"> <div class="container">
<ul class="nav nav-tabs" role="tablist">
<div class="container"> <li class="nav-item">
<!-- Nav tabs --> <a class="nav-link active" data-toggle="tab" href="#menu3" id="existing_courses">Existing courses</a>
<ul class="nav nav-tabs" role="tablist"> </li>
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#menub" id="existing_courses">Existing Courses</a>
</li>
</ul>
<!-- Tab panes -->
</ul>
</div> </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> <hr>
<table class="table-bordered" style="font-size: 10pt;"> <table class="table-bordered" style="font-size: 10pt;">
<tr> <tr>
<th>Course Name </th> <th>Course Name</th>
<th> Faculty </th> <th>Faculty</th>
<th>Lecturer </th> <th>Lecturer</th>
<th>TAs</th> <th>TAs</th>
<th>Assign new TA </th> <th>Assign new TA </th>
</tr> </tr>
<?php <?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'];
if (mysqli_num_rows($result) == 0) { $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 (mysqli_num_rows($result) == 0) {
$counter = 0; } else {
while ($row = mysqli_fetch_assoc($result)) { $counter = 0;
$name = $row['Course_Name']; while ($row = mysqli_fetch_assoc($result)) {
$code = $row['Course_Code']; $name = $row['Course_Name'];
$faculty = $row['Faculty']; $code = $row['Course_Code'];
$lecturer = $row['Full_Name']; $faculty = $row['Faculty'];
$academic = $row['Academic_Year']; $lecturer = $row['Full_Name'];
$c_id = $row['Course_ID']; $academic = $row['Academic_Year'];
$counter += 1; $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` $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");
INNER JOIN users_table on users_table.User_ID=course_ta.TA
where course_ta.Course_ID=$c_id");
$ta = ""; $ta = "";
while ($rowTA = mysqli_fetch_assoc($resultTA)) { while ($rowTA = mysqli_fetch_assoc($resultTA)) {
$ta = $ta . " - " . $rowTA['TA_NAME']; $ta = $ta . " - " . $rowTA['TA_NAME'];
} }
echo " 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=''>"; <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) { if (mysqli_num_rows($resultx) == 0) {
} else { } else {
while ($row = mysqli_fetch_assoc($resultx)) { while ($row = mysqli_fetch_assoc($resultx)) {
$id = $row['User_ID']; $id = $row['User_ID'];
$name = $row['Full_Name']; $name = $row['Full_Name'];
echo "<option value='$id'> $name </option>"; echo "<option value='$id'> $name </option>";
} }
} }
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'> <input type='submit' value='assign' id='assign_btn_$counter'></form> </td></tr>
"; ";
} }
} ?> } ?>
</table> </table>
</div> </div>
</div>
</div> </div>
<script> </div>
function updatePass(id, pass) {
if (!confirm('Are you to Reset User Password')) {
return;
}
window.location.href = "\Script.php\?action=passchange&uid=" + id + "&pass=" + pass; <script>
} function updatePass(id, pass) {
if (!confirm('Are you sure to reset user password?')) {
return;
}
function blockUser(id, status) { window.location.href = "\Script.php\?action=passchange&uid=" + id + "&pass=" + pass;
if (!confirm('Are you to change User Status')) { }
return;
} function blockUser(id, status) {
window.location.href = "\Script.php\?action=statuschange&uid=" + id + "&status=" + status; if (!confirm('Are you sure to change user status?')) {
} return;
</script> }
window.location.href = "\Script.php\?action=statuschange&uid=" + id + "&status=" + status;
}
</script>

File diff suppressed because it is too large Load Diff

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'> <form method='post' enctype='multipart/form-data' action='Script.php'>
<?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='course_id' value='<?php echo "$id" ?>' required=''/>
<input type='hidden' name='url' value='<?php echo ".$course_url." ?>' required=''/> <input type='hidden' name='url' value='<?php echo ".$course_url." ?>' required=''/>
Deadline Date/Time Deadline (date and time)
<div class='row'> <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-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> <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 Title
<input type='text' name='title' placeholder='Title' class='form-control' required='' value=""> <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> <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=""> <input type='text' name='marks' placeholder='Marks' class='form-control' required='' value="">
Attachment 1 Attachment 1
<input type='file' name='attachment1' placeholder='Attachment 1' class='form-control'> <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 Attachment 4
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' > <input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' >
<br> <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 <input type='radio' name='type' value='Group' required=''> Group
<hr> <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> </form><br><br><br><br>
<?php <?php
} }
@ -251,7 +251,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
} }
echo "</div>"; 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); error_reporting(0);
if(isset($_SESSION["info_Updated"])){ 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") 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) 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) 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)) { } else { while($row = mysqli_fetch_assoc($result)) {
$id=$row['ID']; $id=$row['ID'];
@ -464,7 +464,7 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'"
<?php <?php
if( $_SESSION['user_type']=="TA") 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"){ ?> 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"> <form method="post" action="Script.php">
<input type="hidden" name="frm_createCourse" value="true" required=""/> <input type="hidden" name="frm_createCourse" value="true" required=""/>
<input type="hidden" name="l" value="l" 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=""> <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=""> <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"> <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=""> <input type="text" name="academic" placeholder="Academic Year" class="form-control" required="">
Faculty <br> 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']; ?>"> <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="1"> Yes
<input type="radio" name="verify" value="0" checked=""> No <input type="radio" name="verify" value="0" checked=""> No
@ -570,7 +570,7 @@ if( $_SESSION['user_type']=="Student")
if(mysqli_num_rows($result)==0) if(mysqli_num_rows($result)==0)
{ {
echo "No results found for your Search <hr>"; echo "No results found ... <hr>";
} else { } else {
@ -643,9 +643,9 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl
<form method='get' action='Courses.php'> <form method='get' action='Courses.php'>
<div class='row'> <div class='row'>
<div class='col-md-10'> <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'> <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 List courses by faculty
<select name='faculty' class='form-control'>"; <select name='faculty' class='form-control'>";

View File

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

View File

@ -1,7 +1,7 @@
<?php <?php
// https://stackoverflow.com/questions/33999475/prevent-direct-url-access-to-php-file // https://stackoverflow.com/questions/33999475/prevent-direct-url-access-to-php-file
if (!isset($_SERVER['HTTP_REFERER']) ) { if (!isset($_SERVER['HTTP_REFERER']) ) {
/* choose the appropriate page to redirect users */ /* choose the appropriate page to redirect users */
die( header( 'location: logout.php' ) ); die( header( 'location: logout.php' ) );
} }
?> ?>

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 <?php
$page = "student"; $page = "student";
include 'Header.php'; include 'Header.php';
?> ?>
<br><br><br> <br><br><br>
@ -9,7 +8,7 @@ include 'Header.php';
<div class="row" style="width:80%;margin:auto;"> <div class="row" style="width:80%;margin:auto;">
<div class="col-md-6"> <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>
</div> </div>

View File

@ -10,126 +10,121 @@ include 'Header.php';
<div class='row' style='width:80%;margin:auto;'> <div class='row' style='width:80%;margin:auto;'>
<?php <?php
$c_date = date("Y-m-d H:i"); $c_date = date("Y-m-d H:i");
$student_id = $_SESSION["user_student_id"]; $student_id = $_SESSION["user_student_id"];
if(!empty($_GET["id"])) 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)
{ {
echo "No active assignments for this course so far."; $id = mysqli_real_escape_string($con, $_GET["id"]);
$url = mysqli_real_escape_string($con, $_GET["url"]);
} else { $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.";
while($row = mysqli_fetch_assoc($result1)) { } else {
$Course_ID = $row['Course_ID']; while($row = mysqli_fetch_assoc($result1)) {
$title = $row['Title'];
$ins = $row['Instructions'];
$posted = $row['Posted_Date'];
$deadline = $row['Deadline'];
$att1 = $row['Attachment_link_1'];
$att2 = $row['Attachment_link_2'];
$att3 = $row['Attachment_link_3'];
$att4 = $row['Attachment_link_4'];
$labid = $row['Lab_Report_ID'];
$type = $row['Type'];
//----------------------------------Giving both the Group Admin and Group Members same priviledges to submit assignment-------------------------------------- $Course_ID = $row['Course_ID'];
if($type=="Group"){ $title = $row['Title'];
$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))"); $ins = $row['Instructions'];
while($row = mysqli_fetch_assoc($resultx1)) { $posted = $row['Posted_Date'];
$_SESSION["Group_ID"] = $row['Course_Group_id']; $deadline = $row['Deadline'];
} $att1 = $row['Attachment_link_1'];
$att2 = $row['Attachment_link_2'];
$att3 = $row['Attachment_link_3'];
$att4 = $row['Attachment_link_4'];
$labid = $row['Lab_Report_ID'];
$type = $row['Type'];
if($_SESSION["Group_ID"] < 1) //----------------------------------Giving both the Group Admin and Group Members same priviledges to submit assignment--------------------------------------
{ if($type=="Group"){
echo" <center><h3> This Lab report can only be submitted by Group Admin </h3> </center> "; $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))");
return; 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> ";
return;
}
}
$full_link="<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>"; $full_link="<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>";
if($att2!=""){ if($att2!=""){
$full_link = $full_link."| <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>"; $full_link = $full_link."| <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>";
} }
if($att3!=""){ if($att3!=""){
$full_link = $full_link."| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>"; $full_link = $full_link."| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>";
} }
if($att4!=""){ if($att4!=""){
$full_link = $full_link."| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>"; $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'> 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 Courses > $url > Submlit Lab Report > $title
<br> <br>
</a></div> </a></div>
"; ";
echo ""; echo "";
} }
}
} }
}
$Group_ID = $_SESSION["Group_ID"]; $Group_ID = $_SESSION["Group_ID"];
?> ?>
</div> </div>
<div style="width:80%;margin:auto;"> <div style="width:80%;margin:auto;">
<h3> Submit Lab Report Assignment </h3> <h3>Submit assignment</h3>
<hr> <hr>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<form method='post' enctype='multipart/form-data' action='Script.php'> <form method='post' enctype='multipart/form-data' action='Script.php'>
<input type='hidden' name='frm_submitlab' value='true' required=''/> <input type='hidden' name='frm_submitlab' value='true' required=''/>
<input type='hidden' name='lab_id' value='<?php echo $id; ?>' 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='student_id' value='<?php echo $student_id; ?>' required=''/>
<input type='hidden' name='group_id' value='<?php echo $Group_ID; ?>' required=''/> <input type='hidden' name='group_id' value='<?php echo $Group_ID; ?>' required=''/>
<input type='hidden' name='url' value='<?php echo $url; ?>' required=''/> <input type='hidden' name='url' value='<?php echo $url; ?>' required=''/>
Title Title
<input type='text' name='title' placeholder='Ttle' class='form-control' required=''> <input type='text' name='title' placeholder='Ttle' class='form-control' required=''>
Attachment 1 Attachment 1
<input type='file' name='attachment1' placeholder='Attachment 1' class='form-control' required=''> <input type='file' name='attachment1' placeholder='Attachment 1' class='form-control' required=''>
Attachment 2 Attachment 2
<input type='file' name='attachment2' placeholder='Attachment 2' class='form-control'> <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' >
Attachment 3 Attachment 4
<input type='file' name='attachment3' placeholder='Attachment 3' class='form-control' > <input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' >
<br>
Attachment 4 <input type='submit' class='btn btn-primary' value='Submit'><br>
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' > </form>
<br>
<input type='submit' class='btn btn-primary' value='Submit Lab Assignment'><br> </div>
</form>
</div> </div>
</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>

View File

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

@ -1,60 +1,43 @@
<?php <?php
include 'NoDirectPhpAcess.php'; include 'NoDirectPhpAcess.php';
?> ?>
<?php <?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'; include 'Header.php';
?> ?>
<div class="row"> <div class="row">
<div class="col-md-4 list-group" style="margin:auto;"> <div class="col-md-4 list-group" style="margin:auto;">
<br> <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="list-group-item">
<div class="panel-body"> <div class="panel-body">
<form method="post" action="Script.php"> <form method="post" action="Script.php">
<input type="hidden" name="frm_recover_password" value="true"/> <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']); ?>"> 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/> <br/>
Email <input type="text" name="email" placeholder="Enter your email address" class="form-control" required="required" value="<?php echo htmlspecialchars($_SESSION['user_email']); ?>"> Email <input type="text" name="email" placeholder="Enter your email address" class="form-control" required="required" value="<?php echo htmlspecialchars($_SESSION['user_email']); ?>">
<br/> <br/>
<input type="submit" class="btn-primary" value="Recover"> <input type="submit" class="btn-primary" value="Recover">
</form>
</form> <?php
<?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;
}
if(isset($_SESSION['info_recover_password'])) { ?>
echo '<hr><div class="alert alert-danger" role="alert">'.htmlspecialchars($_SESSION['info_recover_password']).'</div>'; </div>
$_SESSION['info_recover_password']=null;
}
?> </div>
<style> </div>
/*------------------------------------------------------------------
[ Login Button ]*/ </div>
.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>

View File

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