From e455355da1192d901558f354b2d29b6fe14dd1ec Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Mon, 31 Jul 2023 16:08:30 +0800 Subject: [PATCH 001/151] Remove redundant css link --- Header.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Header.php b/Header.php index 63ad2ce..70f93e3 100644 --- a/Header.php +++ b/Header.php @@ -21,7 +21,6 @@ if (mysqli_connect_errno()) { - - - Courses (current)"; - ?> - - -
- Welcome     - - - -  Admin "; - } - ?> - -     -  Update password -      Logout - - -
- - + + + + + + + - - + + + - + - + - + - - + 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; + } + From 346fb348c721da4db71dd14f8d39ccb34fce5f2c Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Mon, 31 Jul 2023 17:13:36 +0800 Subject: [PATCH 010/151] Move css class .form-control from Courses.php to Header.php --- Courses.php | 4 ---- Header.php | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Courses.php b/Courses.php index 5bba2fc..414b916 100644 --- a/Courses.php +++ b/Courses.php @@ -780,10 +780,6 @@ List courses by faculty diff --git a/Header.php b/Header.php index 1bb45e9..2067e83 100644 --- a/Header.php +++ b/Header.php @@ -139,6 +139,10 @@ if (mysqli_connect_errno()) { color: #2471A3; } + .form-control{ + padding-top: 1px; + padding-bottom:1px; + } From 197437f6a1c4dfa8ac599529c87772f9a08a7819 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Mon, 31 Jul 2023 17:15:35 +0800 Subject: [PATCH 011/151] Make Courses.php look better --- Courses.php | 1030 +++++++++++++++++++++++---------------------------- 1 file changed, 458 insertions(+), 572 deletions(-) diff --git a/Courses.php b/Courses.php index 414b916..4279f40 100644 --- a/Courses.php +++ b/Courses.php @@ -13,74 +13,74 @@ $user_d = $_SESSION['user_id']; if( $_SESSION['user_type']=="Lecturer" || $_SESSION['user_type']=="TA") { - ?> +?> -
- +
+ - - - + + + - - + - Faculty: $faculty | Year: $academic | Lecturer: $lecturer

- "; - + "; + echo "
"; } - - // ------------------------------Editing Lab Assignment by Lecturer ------------------------------------ + + // ------------------------------Editing Lab Assignment by Lecturer ------------------------------------ - 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'"); + 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) ); - $_SESSION['Time'] = trim( strstr($Deadline, ' ') ); - $_SESSION['Instructions'] = $row1['Instructions']; - $_SESSION['Title'] = $row1['Title']; - $_SESSION['Marks'] = $row1['Marks']; - $_SESSION['Type'] = $row1['Type']; - } - - if(isset($_POST['frm_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"]); - $title = mysqli_real_escape_string($con, $_POST["title"]); - $marks = mysqli_real_escape_string($con, $_POST["marks"]); - $type = mysqli_real_escape_string($con, $_POST["type"]); - $Deadline = $deadlinedate." ".$deadlinetime; - $date = date("Y-m-d H:i"); - - $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 . "
" . $con->error; - echo "Serious error happened whiling updating assignment information."; + while($row1 = mysqli_fetch_assoc($result1)) { + $Deadline = $row1['Deadline']; + $_SESSION['Date'] = trim( strstr($Deadline, ' ', true) ); + $_SESSION['Time'] = trim( strstr($Deadline, ' ') ); + $_SESSION['Instructions'] = $row1['Instructions']; + $_SESSION['Title'] = $row1['Title']; + $_SESSION['Marks'] = $row1['Marks']; + $_SESSION['Type'] = $row1['Type']; } - } - - if( $_SESSION['user_type']=="Lecturer"){ - $Date = $_SESSION['Date']; - $Time = $_SESSION['Time']; - $Instructions = $_SESSION['Instructions']; - $Title = $_SESSION['Title']; - $Marks = $_SESSION['Marks']; - $Type = $_SESSION['Type']; - - echo "

Editing Lab Assignment

"; - ?> -
- - - - - Deadline Date/Time -
+ + if(isset($_POST['frm_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"]); + $title = mysqli_real_escape_string($con, $_POST["title"]); + $marks = mysqli_real_escape_string($con, $_POST["marks"]); + $type = mysqli_real_escape_string($con, $_POST["type"]); + $Deadline = $deadlinedate." ".$deadlinetime; + $date = date("Y-m-d H:i"); + + $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 . "
" . $con->error; + echo "Serious error happened whiling updating assignment information."; + } + } + + if( $_SESSION['user_type']=="Lecturer"){ + $Date = $_SESSION['Date']; + $Time = $_SESSION['Time']; + $Instructions = $_SESSION['Instructions']; + $Title = $_SESSION['Title']; + $Marks = $_SESSION['Marks']; + $Type = $_SESSION['Type']; + + echo "

Editing Lab Assignment

"; + ?> + + + + + + Deadline Date/Time +
">
">
-
+
- Title - "> - Instructions - - Marks - "> - Attachment 1 - + Title + "> + Instructions + + Marks + "> + Attachment 1 + - Attachment 2 - + Attachment 2 + - Attachment 3 - + Attachment 3 + - Attachment 4 - -
+ Attachment 4 + +
- Individual Group"; - } else { - echo "Submission Type Individual Group"; - } - ?> + Individual Group"; + } else { + echo "Submission Type Individual Group"; + } + ?> -
-
-




- +
+



+ - -

Post new Lab Assignment

+ ?> + +

Post new Lab Assignment

+ +
+ + + + - - - - - - - Deadline Date/Time -
+ Deadline Date/Time +
-
+
- Title - - Instructions - - Marks - - Attachment 1 - + Title + + Instructions + + Marks + + Attachment 1 + - Attachment 2 - + Attachment 2 + - Attachment 3 - + Attachment 3 + - Attachment 4 - -
- Submission Type Individual + Attachment 4 + +
+ Submission Type Individual - Group -
-
-




- Group +
+
+



+ "; - + echo "

Lab Report Assignment list

"; - + error_reporting(0); if(isset($_SESSION["info_Updated"])){ echo '
'; @@ -268,12 +268,12 @@ New Date/Time
*Only Lecturer can post a new lab report assignment
"; @@ -281,403 +281,364 @@ New Date/Time
$att2"; - } - if($att3!=""){ - $full_link= $full_link."  |  $att3"; - } - - if($att4!=""){ - $full_link= $full_link."   |   $att4"; - } - - - - - $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'];}} - - - $header="Courses > ".$name."($code) > Assignments > ".$title; - - echo "
+ $marks=$row['Marks']; + $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']; + $id=$row['Lab_Report_ID']; + $cours_id=$row['Course_ID']; + $as_type=$row['Type']; + $full_link="$att1"; + + if($att2!=""){ + $full_link= $full_link."  |  $att2"; + } + if($att3!=""){ + $full_link= $full_link."  |  $att3"; + } + + if($att4!=""){ + $full_link= $full_link."   |   $att4"; + } + + + + + $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'];}} + + + $header="Courses > ".$name."($code) > Assignments > ".$title; + + echo "
$title ($as_type)
$ins
Posted : $posted Deadline : $deadline   ($marks Marks)           " - . "
" + . "
" - . "    $count_subs Submissions ( $count_marked Marked )       Edit   |   View    |   Extend Deadline
Attachments : $full_link
" - . "  
- "; - - - - }} + . "    $count_subs Submissions ( $count_marked Marked )       Edit   |   View    |   Extend Deadline
Attachments : $full_link " + . "  
+ "; + + + + }} echo "
"; - - - - - + + + + + $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 ""; - - - - + . "" + . " "; + + + + return; - } - - ?> + } + + ?> - -
- - + + - "; - - - $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`, + "; + + + $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"); - } - // $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"); + } + // $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)) { - $id=$row['Course_ID']; - $name=$row['Course_Name']; - $code=$row['Course_Code']; - $faculty=$row['Faculty']; - $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` + + if(mysqli_num_rows($result)==0) + {} else { while($row = mysqli_fetch_assoc($result)) { + $id=$row['Course_ID']; + $name=$row['Course_Name']; + $code=$row['Course_Code']; + $faculty=$row['Faculty']; + $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"); - - $ta=""; - while($rowTA = mysqli_fetch_assoc($resultTA)) { - $ta=$ta." - ".$rowTA['TA_NAME']; - } - - - - echo" + + $ta=""; + while($rowTA = mysqli_fetch_assoc($resultTA)) { + $ta=$ta." - ".$rowTA['TA_NAME']; + } + + + + echo"
($code) - $name
Faculty : $faculty        Year : $academic        Lecturer :$lecturer        TA:$ta
- "; - - }}?> -
-
-
- Course Joining Requests - + "; + + }}?> +
+
+
+ Course Joining Requests + - No Course joining request so far for all your courses
"; - } 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']; - $academic=$row['Academic_Year']; - - echo "
+ + if(mysqli_num_rows($result)==0) + { + + echo "
No Course joining request so far for all your courses
"; + } 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']; + $academic=$row['Academic_Year']; + + echo "
$std_name is Requesting to join
[($code) - $name ]     
Accept    Decline
"; - - - - } - } - ?> + + } + } + ?> - - - - -Only Lecturers can Post new Lab report Assignments"; - } - if( $_SESSION['user_type']=="Lecturer"){ ?> - - Create new Course Portal + Only Lecturers can Post new Lab report Assignments"; + } + if( $_SESSION['user_type']=="Lecturer"){ ?> -
- - - Course Name - + Create new Course Portal + + + + + Course Name + - Course Code - + Course Code + - URL (Leave blank to use Course Code & Year) - + URL (Leave blank to use Course Code & Year) + - Academic Year - + Academic Year + - Faculty
- + Faculty
+ - + - Verify Joining Students - Yes - No + Verify Joining Students + Yes + No -
-
- -
- - +
+
+ + + +
- - - + + + +?> -
-
-
Course Portal > Students
-' . $_SESSION['info_Courses_student'] . ''; - $_SESSION['info_Courses_student'] = null; - } - ?> -

+
+
+
Course Portal > Students
+ ' . $_SESSION['info_Courses_student'] . ''; + $_SESSION['info_Courses_student'] = null; + } + ?> +

+
+
-
-
- - -
-
- - - - Search Results for Course Code $search
"; - $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 "

Find Courses under faculty $faculty

"; - $result = mysqli_query($con,"SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`, +
+ + Search Results for Course Code $search
"; + $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 "

Find Courses under faculty $faculty

"; + $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
"; + if(mysqli_num_rows($result)==0) + { + echo "No results found for your Search
"; - } 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']; - $url=$row['URL']; - $id=$row['Course_ID']; - $v=$row['Verify_New_Members']; - $msg2="Join Course"; - if($v>0) - { - $msg=" Lecturer verification required"; - $msg2="Send Joining Request"; - } - - echo "
+ } 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']; + $url=$row['URL']; + $id=$row['Course_ID']; + $v=$row['Verify_New_Members']; + $msg2="Join Course"; + if($v>0) + { + $msg=" Lecturer verification required"; + $msg2="Send Joining Request"; + } + + echo "
[$code] $name
($url)
$msg2
Faculty: $faculty | Year: $academic | Lecturer: $lecturer
$msg
"; - } - } - } - // Otherwise, list the student's joined courses (already done), in reverse chronological order - echo "

My Courses

"; - $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` + } + } + } + // Otherwise, list the student's joined courses (already done), in reverse chronological order + echo "

My Courses

"; + $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"); - - if(mysqli_num_rows($result)==0) - { - echo " 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']; - $url=$row['URL']; - $id=$row['Course_ID']; - $Status=$row['Status']; - - if($Status=="Joined") - { - echo "
+ + if(mysqli_num_rows($result)==0) + { + echo " 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']; + $url=$row['URL']; + $id=$row['Course_ID']; + $Status=$row['Status']; + + if($Status=="Joined") + { + echo "
($code) - $name
($url)     $Status     
Open
Faculty : $faculty Year : $academic Lecturer :$lecturer
"; - } - else - { - echo "
+ } + else + { + echo "
($code) - $name $Status
Faculty : $faculty Year : $academic Lecturer :$lecturer
"; - } - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo "
+ } + } + } + + echo "
@@ -688,17 +649,17 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl List courses by faculty
+ echo "

@@ -707,84 +668,9 @@ List courses by faculty
- - - -
"; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} - -?> - - - - - - - - - - - - - - - + + } + + ?> From 975cdfec63b7e47f2590e3b64ede86d8f9aa00bc Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Mon, 31 Jul 2023 17:42:22 +0800 Subject: [PATCH 012/151] Review & revise the files under directory doc/ --- doc/IncreaseSessionDuration.txt | 13 ++++++++ doc/Issues.txt | 25 +++++++++++++-- doc/QuickStart.txt | 26 +++++++++++++++ doc/Quick_Start.txt | 32 ------------------- doc/{Reset_Database.txt => ResetDatabase.txt} | 4 +-- doc/ResetPassword.txt | 24 ++++++++++++++ doc/UserDoc.md | 26 --------------- doc/ashlys_issues.txt | 10 ------ 8 files changed, 87 insertions(+), 73 deletions(-) create mode 100644 doc/IncreaseSessionDuration.txt create mode 100644 doc/QuickStart.txt delete mode 100644 doc/Quick_Start.txt rename doc/{Reset_Database.txt => ResetDatabase.txt} (92%) create mode 100644 doc/ResetPassword.txt delete mode 100644 doc/UserDoc.md delete mode 100644 doc/ashlys_issues.txt diff --git a/doc/IncreaseSessionDuration.txt b/doc/IncreaseSessionDuration.txt new file mode 100644 index 0000000..881d8ef --- /dev/null +++ b/doc/IncreaseSessionDuration.txt @@ -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* diff --git a/doc/Issues.txt b/doc/Issues.txt index e79cc3e..b41ded8 100644 --- a/doc/Issues.txt +++ b/doc/Issues.txt @@ -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 + +* Lecturer/TA should see his/her feedback on submissions + +* 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 - -* Remarking request details required \ No newline at end of file diff --git a/doc/QuickStart.txt b/doc/QuickStart.txt new file mode 100644 index 0000000..195a563 --- /dev/null +++ b/doc/QuickStart.txt @@ -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 + + + diff --git a/doc/Quick_Start.txt b/doc/Quick_Start.txt deleted file mode 100644 index e6df0fe..0000000 --- a/doc/Quick_Start.txt +++ /dev/null @@ -1,32 +0,0 @@ - -

Quick Start Guide

-
- - -* 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 - -* - - diff --git a/doc/Reset_Database.txt b/doc/ResetDatabase.txt similarity index 92% rename from doc/Reset_Database.txt rename to doc/ResetDatabase.txt index 620daa0..0b842a5 100644 --- a/doc/Reset_Database.txt +++ b/doc/ResetDatabase.txt @@ -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; diff --git a/doc/ResetPassword.txt b/doc/ResetPassword.txt new file mode 100644 index 0000000..a197b1f --- /dev/null +++ b/doc/ResetPassword.txt @@ -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* diff --git a/doc/UserDoc.md b/doc/UserDoc.md deleted file mode 100644 index 8a78d83..0000000 --- a/doc/UserDoc.md +++ /dev/null @@ -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* diff --git a/doc/ashlys_issues.txt b/doc/ashlys_issues.txt deleted file mode 100644 index 206f7b9..0000000 --- a/doc/ashlys_issues.txt +++ /dev/null @@ -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 \ No newline at end of file From a56b4c00dd96177f09fdf9f5ad196d5de76c4334 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Tue, 1 Aug 2023 17:02:33 +0800 Subject: [PATCH 013/151] (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. --- Admin.php | 431 ++++++++--------- Course.php | 1086 +++++++++++++++++++++--------------------- Courses.php | 34 +- Header.php | 4 + NoDirectPhpAcess.php | 10 +- Reset_password.php | 49 -- Student.php | 5 +- SubmitLab.php | 189 ++++---- Visitors.php | 63 --- logout.php | 1 + phpinfo.php | 7 - recover_password.php | 73 ++- signup.php | 14 - 13 files changed, 899 insertions(+), 1067 deletions(-) delete mode 100644 Reset_password.php delete mode 100644 Visitors.php delete mode 100644 phpinfo.php diff --git a/Admin.php b/Admin.php index 8280aa5..bf39f0f 100644 --- a/Admin.php +++ b/Admin.php @@ -16,278 +16,261 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") { ?> - -
-

Administration Panel

+

Administration panel


- -
+
- TA Account Management -
" ; - echo "TA Accounts
" ; - } - else if($_SESSION['user_type'] == "Admin"){ - echo "

Lecturer Account Management

-
"; - echo "Lecturer Accounts
"; - } - - ?> - -
- - - - - -
- -

- - Create TA Accounts "; + - Passport Number / ID (Used as Initial Password) - -
User Type : +
- +
+ + + + + + + + +
+
-
-
+
-
- -
- - - - +
+
- -
- \ No newline at end of file + window.location.href = "\Script.php\?action=passchange&uid=" + id + "&pass=" + pass; + } + + function blockUser(id, status) { + if (!confirm('Are you sure to change user status?')) { + return; + } + window.location.href = "\Script.php\?action=statuschange&uid=" + id + "&status=" + status; + } + diff --git a/Course.php b/Course.php index 5dc8583..ae67582 100644 --- a/Course.php +++ b/Course.php @@ -15,17 +15,17 @@ if(!empty($_GET["url"])) { $course_url = mysqli_real_escape_string($con, $_GET["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' "); - + . " `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) { echo "No course matching the given course URL: ".$course_url; } else { while($row = mysqli_fetch_assoc($result)) { - $name = $row['Course_Name']; + $name = $row['Course_Name']; $code = $row['Course_Code']; $faculty = $row['Faculty']; $lecturer = $row['Full_Name']; @@ -55,18 +55,18 @@ if(!empty($_GET["url"]))
-'; - $_SESSION['info_general']=null; -} - -if (isset($_SESSION['info_courses'])) { - echo '
'; - $_SESSION['info_courses']=null; -} -?> + if (isset($_SESSION['info_general'])) { + echo '
'; + $_SESSION['info_general']=null; + } + + if (isset($_SESSION['info_courses'])) { + echo '
'; + $_SESSION['info_courses']=null; + } + ?>
@@ -77,232 +77,232 @@ if (isset($_SESSION['info_courses'])) { if( $_SESSION['user_type'] == "Student") { - ?> +?>
-
- - +
+ + - - -
- + +
+

Class Groups

+ + Create Group"; - - ?> - - - -
-Create group"; + + ?> + + + +
+ Invite Others"; - - if($status=="Invited") - { - $extra2=" Accept"; - $extra3=" Decline"; - - } + + if(mysqli_num_rows($result)==0) + { + echo "You have no group in this course."; + } else { while($row = mysqli_fetch_assoc($result)) { + $name=$row['Group_Name']; + $id=$row['Course_Group_id']; + $status=$row['Status']; + + + $extra=" - Invite Others"; + + if($status=="Invited") + { + $extra2=" Accept"; + $extra3=" Decline"; + + } - # Add "delete group" button and allow only group creator to delete it - $extra4 = ""; - echo "
$name ($status) $extra $extra2 $extra3" . - (($status == "Created")? "$extra4": "") - ."
"; - - $rs2=mysqli_query($con,"SELECT `ID`, `Course_Group_id`, course_group_members_table.Student_ID, + echo "
$name ($status) $extra $extra2 $extra3" . + (($status == "Created")? "$extra4": "") + ."
"; + + $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"); - - #Check whether the current user in session is the creator of the group - $rs3 = mysqli_query($con, "SELECT `Status` from course_group_members_table where Student_ID = $student_id"); - $flag = mysqli_fetch_assoc($rs3)['Status'] == "Created"; + + #Check whether the current user in session is the creator of the group + $rs3 = mysqli_query($con, "SELECT `Status` from course_group_members_table where Student_ID = $student_id"); + $flag = mysqli_fetch_assoc($rs3)['Status'] == "Created"; - while($row = mysqli_fetch_assoc($rs2)) { - $name=$row['Full_Name']; - $id=$row['Course_Group_id']; - $status=$row['Status']; - $Student_ID=$row['Student_ID']; - - #Show group members + remove button next to each member except the creator of the group - if($flag){ - echo "
  • $name-$Student_ID ($status)".(($status != "Created")?"":"")."
  • "; - }else{ - echo "
  • $name-$Student_ID ($status)"; - } - + }else{ + echo "
  • $name-$Student_ID ($status)"; + } + + } + + + + + + + } - - - - - - - - } - } - ?> - + } + ?> + - - - -
  • - + + + +
    +
    @@ -596,66 +596,66 @@ include 'Footer.php'; - + diff --git a/Courses.php b/Courses.php index 4279f40..a82642f 100644 --- a/Courses.php +++ b/Courses.php @@ -203,7 +203,7 @@ New Date/Time
    -

    Post new Lab Assignment

    +

    New an assignment

    - Deadline Date/Time + Deadline (date and time)
    @@ -221,9 +221,9 @@ New Date/Time
    - Instructions + Instruction - Marks + Mark Attachment 1 @@ -238,11 +238,11 @@ New Date/Time

    - Submission Type Individual + Submission type: Individual Group
    -
    +




    "; - echo "

    Lab Report Assignment list

    "; + echo "

    Assignment list

    "; error_reporting(0); if(isset($_SESSION["info_Updated"])){ @@ -276,7 +276,7 @@ New Date/Time
    *Only Lecturer can post a new lab report assignment
    "; + echo "Only Lecturer can post assignments.
    "; } 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 "
    No Course joining request so far for all your courses
    "; + echo "
    No course-joining request so far for all your courses
    "; } 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'" Only Lecturers can Post new Lab report Assignments"; + echo "
    Only Lecturer can post assignments
    "; } if( $_SESSION['user_type']=="Lecturer"){ ?> @@ -473,16 +473,16 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'"
    - Course Name + Course name - Course Code + Course code URL (Leave blank to use Course Code & Year) - Academic Year + Academic year Faculty
    @@ -492,7 +492,7 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'" - Verify Joining Students + Verify joining students? Yes No @@ -570,7 +570,7 @@ if( $_SESSION['user_type']=="Student") if(mysqli_num_rows($result)==0) { - echo "No results found for your Search
    "; + echo "No results found ...
    "; } else { @@ -643,9 +643,9 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl
    -
    Find course by Code +
    Find course by course code -
    +
    List courses by faculty - - Email - -
    - New Password - - -
    - -
    - - -
    - -
    -
    - -
    - -
    -
    diff --git a/Student.php b/Student.php index 4541fc5..bcca070 100644 --- a/Student.php +++ b/Student.php @@ -1,7 +1,6 @@


    @@ -9,7 +8,7 @@ include 'Header.php';
    -

    Student Account Created. Now you can Browse Course Portals

    +

    Student account created. Now you can browse the course portal.

    -
    \ No newline at end of file +
    diff --git a/SubmitLab.php b/SubmitLab.php index c8b1fdb..167087c 100644 --- a/SubmitLab.php +++ b/SubmitLab.php @@ -10,126 +10,121 @@ include 'Header.php';
    - '$c_date' ORDER by Lab_Report_ID DESC"); - if(mysqli_num_rows($result1) == 0) + $c_date = date("Y-m-d H:i"); + $student_id = $_SESSION["user_student_id"]; + + if(!empty($_GET["id"])) { - 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']; - $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-------------------------------------- - 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))"); - while($row = mysqli_fetch_assoc($resultx1)) { - $_SESSION["Group_ID"] = $row['Course_Group_id']; - } - - if($_SESSION["Group_ID"] < 1) - { - echo"

    This Lab report can only be submitted by Group Admin

    "; - return; - } - } - - - $full_link="$att1"; - - if($att2!=""){ - $full_link = $full_link."| $att2"; - } - if($att3!=""){ - $full_link = $full_link."| $att3"; - } - - if($att4!=""){ - $full_link = $full_link."| $att4"; - } - - echo "
    + $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."; + + } else { + + while($row = mysqli_fetch_assoc($result1)) { + + $Course_ID = $row['Course_ID']; + $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-------------------------------------- + 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))"); + while($row = mysqli_fetch_assoc($resultx1)) { + $_SESSION["Group_ID"] = $row['Course_Group_id']; + } + + if($_SESSION["Group_ID"] < 1) + { + echo"

    This Lab report can only be submitted by Group Admin

    "; + return; + } + } + + + $full_link="
    $att1"; + + if($att2!=""){ + $full_link = $full_link."| $att2"; + } + if($att3!=""){ + $full_link = $full_link."| $att3"; + } + + if($att4!=""){ + $full_link = $full_link."| $att4"; + } + + echo " - "; + "; - echo ""; - } + echo ""; + } + } } -} -$Group_ID = $_SESSION["Group_ID"]; + $Group_ID = $_SESSION["Group_ID"]; -?> + ?>
    - -
    -

    Submit Lab Report Assignment

    -
    +

    Submit assignment

    +
    - -
    + +
    -
    - - - - - - - Title - + + + + + + + + Title + - Attachment 1 - + Attachment 1 + - Attachment 2 - + Attachment 2 + -
    -
    + Attachment 3 + - Attachment 3 - + Attachment 4 + +
    + +
    + + +
    - Attachment 4 - -
    - -
    - - -
    - -
    +
    diff --git a/Visitors.php b/Visitors.php deleted file mode 100644 index c732ce2..0000000 --- a/Visitors.php +++ /dev/null @@ -1,63 +0,0 @@ - - - - "; - - $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 = "$att1"; - - if ($att2 != "") { - $full_link = $full_link . "| $att2"; - } - if ($att3 != "") { - $full_link = $full_link . "| $att3"; - } - - if ($att4 != "") { - $full_link = $full_link . "| $att4"; - } - - echo " - -
    - $title by $gname $sname -
    Submission Date :$sdate      Files : $full_link -
    - "; - } - } ?> -
    \ No newline at end of file diff --git a/logout.php b/logout.php index 7ff6624..8b98508 100644 --- a/logout.php +++ b/logout.php @@ -2,6 +2,7 @@ // Start a new session session_start(); + // Destory sessions & redirect to index session_destroy(); session_unset(); diff --git a/phpinfo.php b/phpinfo.php deleted file mode 100644 index 74a8ccc..0000000 --- a/phpinfo.php +++ /dev/null @@ -1,7 +0,0 @@ -'; -echo 'LOADED EXTENSIONS:
    '; -print_r(get_loaded_extensions()); -echo ''; -echo phpinfo(); -?> \ No newline at end of file diff --git a/recover_password.php b/recover_password.php index d9ae8a2..0e9348d 100644 --- a/recover_password.php +++ b/recover_password.php @@ -1,60 +1,43 @@
    - -
    + +
    -
    - -

    Reset my password

    -
    +
    + +

    Reset password

    +
    -
    -
    - - Student number -
    - Email -
    - - -
    +
    +
    + + Student number +
    + Email +
    + +
    -'; - $_SESSION['info_recover_password']=null; -} + if(isset($_SESSION['info_recover_password'])) { + echo '
    '; + $_SESSION['info_recover_password'] = null; + } -?> + ?> +
    - +
    + +
    + +
    diff --git a/signup.php b/signup.php index ae17b5e..b5c7d3b 100644 --- a/signup.php +++ b/signup.php @@ -48,17 +48,3 @@ include 'Header.php';
    - \ No newline at end of file From 02da71b1305d558ce34026b132932848ca132a97 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Wed, 2 Aug 2023 14:57:08 +0800 Subject: [PATCH 014/151] Make Submissions.php look better. --- #**scratch**# | 28 ++++++++++++++++++ .#**scratch** | 1 + Footer.php | 4 +-- Header.php | 3 +- Submissions.php | 78 +++++++++++++++++-------------------------------- 5 files changed, 58 insertions(+), 56 deletions(-) create mode 100644 #**scratch**# create mode 120000 .#**scratch** diff --git a/#**scratch**# b/#**scratch**# new file mode 100644 index 0000000..7f52490 --- /dev/null +++ b/#**scratch**# @@ -0,0 +1,28 @@ + function mark(id, title, marks) { + + try { + + $('
    ' + + title + ' (' + marks + ' marks)' + + '\n\
    Marks \n\ + Comments \n\ +
    ').dialog({ + modal: true, + title: 'Mark submission', + buttons: { + 'Submit': function() { + $('#submit-form').submit(); + $(this).dialog('close'); + }, + 'Cancel': function() { + $(this).dialog('close'); + } + + } + }); + + } catch (e) { + alert(e); + } + } + \ No newline at end of file diff --git a/.#**scratch** b/.#**scratch** new file mode 120000 index 0000000..66d8b5f --- /dev/null +++ b/.#**scratch** @@ -0,0 +1 @@ +root@lenovo-xiaoxin-2019.49005:1690466109 \ No newline at end of file diff --git a/Footer.php b/Footer.php index de442d2..9dd24d1 100644 --- a/Footer.php +++ b/Footer.php @@ -1,4 +1,2 @@








    -
    - -
    \ No newline at end of file +
    diff --git a/Header.php b/Header.php index e483351..d29f199 100644 --- a/Header.php +++ b/Header.php @@ -26,8 +26,7 @@ if (mysqli_connect_errno()) { * The reason is to make the css code reusable. * the css file is used by submissions.php --> - - + diff --git a/Submissions.php b/Submissions.php index 3df7614..99172f6 100644 --- a/Submissions.php +++ b/Submissions.php @@ -93,22 +93,22 @@ echo "
    $title
    by: $submitted_by -
    Submitted : $posted
    Attachments : $full_link
    +
    Submitted : $posted
    Attachments : $full_link
    "; } } @@ -268,8 +268,8 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Marked' Order by lab echo "
    - $title
    by : $submitted_by        [ Marked $Marks ]   Visibility : $Visibility -
    Lecturer/TA notes : $notes
    Submitted : $posted
    Attachments : $full_link
    + $title
    by : $submitted_by        [ Marks: $Marks ]   +
    Marking notes: $notes
    Submitted : $posted
    Attachments : $full_link
    "; } } @@ -349,7 +349,7 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'"); echo "
    $title
    by : $submitted_by        [ Marked $Marks ]
    Remarking Reason : $remarking_reason
    Submitted : $posted " - . "" + . "" . "       Ignore Request " . "
    Attachments : $full_link
    "; @@ -412,31 +412,34 @@ where course_group_members_table.Course_Group_id=$id"); include 'Footer.php'; ?> - - - - - - + + + From 58758be8241cd853593e7e90c07dff5453f0f90d Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Wed, 2 Aug 2023 14:58:28 +0800 Subject: [PATCH 015/151] Remove **scratch** --- #**scratch**# | 28 ---------------------------- .#**scratch** | 1 - 2 files changed, 29 deletions(-) delete mode 100644 #**scratch**# delete mode 120000 .#**scratch** diff --git a/#**scratch**# b/#**scratch**# deleted file mode 100644 index 7f52490..0000000 --- a/#**scratch**# +++ /dev/null @@ -1,28 +0,0 @@ - function mark(id, title, marks) { - - try { - - $('
    ' - + title + ' (' + marks + ' marks)' + - '\n\
    Marks \n\ - Comments \n\ -
    ').dialog({ - modal: true, - title: 'Mark submission', - buttons: { - 'Submit': function() { - $('#submit-form').submit(); - $(this).dialog('close'); - }, - 'Cancel': function() { - $(this).dialog('close'); - } - - } - }); - - } catch (e) { - alert(e); - } - } - \ No newline at end of file diff --git a/.#**scratch** b/.#**scratch** deleted file mode 120000 index 66d8b5f..0000000 --- a/.#**scratch** +++ /dev/null @@ -1 +0,0 @@ -root@lenovo-xiaoxin-2019.49005:1690466109 \ No newline at end of file From a1707314f5d1b2a9da3e8a7bd252f55c76aa629c Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Wed, 2 Aug 2023 15:02:19 +0800 Subject: [PATCH 016/151] Script.php: add the enclosing ?> for PHP code. --- Script.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Script.php b/Script.php index c0bfd7e..05545be 100644 --- a/Script.php +++ b/Script.php @@ -1096,3 +1096,4 @@ WHERE lab_report_submissions.Lab_Report_ID='$lab'"; header("Expires: 0"); print "$header\n$data"; } +?> From 7ed74390ceaee1ead3b26dc0c01738b12c9bf7bd Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Wed, 2 Aug 2023 15:03:25 +0800 Subject: [PATCH 017/151] Better JavaScript function name. --- Course.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Course.php b/Course.php index ae67582..20f1986 100644 --- a/Course.php +++ b/Course.php @@ -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 " "; + echo " "; ?> @@ -593,10 +593,9 @@ include 'Footer.php'; - - From 6b8f97dc58459d1a41f730f7968cff0650f56e80 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Wed, 2 Aug 2023 15:12:24 +0800 Subject: [PATCH 019/151] Better JavaScript function name. --- Courses.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Courses.php b/Courses.php index a82642f..e01b6e8 100644 --- a/Courses.php +++ b/Courses.php @@ -29,17 +29,17 @@ if( $_SESSION['user_type']=="Lecturer" || $_SESSION['user_type']=="TA") @@ -326,7 +326,7 @@ New Date/Time
    Posted : $posted Deadline : $deadline   ($marks Marks)           " . "
    " - . "    $count_subs Submissions ( $count_marked Marked )       Edit   |   View    |   Extend Deadline
    Attachments : $full_link
    " + . "    $count_subs Submissions ( $count_marked Marked )       Edit   |   View    |   Extend Deadline
    Attachments : $full_link " . "  
    "; From 122bd27e8061ead9f00e192028a82000b00675a6 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Wed, 2 Aug 2023 15:27:51 +0800 Subject: [PATCH 020/151] Better indented JavaScript code. --- Courses.php | 71 ++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 39 deletions(-) diff --git a/Courses.php b/Courses.php index e01b6e8..72eb8fc 100644 --- a/Courses.php +++ b/Courses.php @@ -26,47 +26,39 @@ if( $_SESSION['user_type']=="Lecturer" || $_SESSION['user_type']=="TA") - - @@ -511,6 +503,7 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'" From 4f7cda823b01dcbdf99d385f01da8b425ceee3a1 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Wed, 2 Aug 2023 15:28:29 +0800 Subject: [PATCH 021/151] Make Courses.php look better. --- Courses.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Courses.php b/Courses.php index 72eb8fc..0a2de79 100644 --- a/Courses.php +++ b/Courses.php @@ -327,10 +327,6 @@ if( $_SESSION['user_type']=="Lecturer" || $_SESSION['user_type']=="TA") }} echo "
    "; - - - - $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 @@ -349,9 +345,6 @@ WHERE Course_ID=$course_id"); . "" . " "; - - - return; } From a758c5a2c6fbb42ad87e00fa308a23912fe3b9c9 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Wed, 2 Aug 2023 15:29:47 +0800 Subject: [PATCH 022/151] Do not track .DS_Store --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 974355addcdd7026e925df3b1255d5d35e1a3001..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}N6?5T4YkX+`Wo&|@y%dT9ND_8=^4J$MsV^q``I{Q`)UXYh@op-^e%c zb(~33QK}aYB4q|9-(-Fg^6ioz01*DLT?eQDfJ7xMl(6|mC{8*f1?M3YW{e($a078P z8uVte+3_D4pl>Ik0~&52hELxw>got%uTig?46<77O%xW2i%ZK=mSuUhd>M4~D9FNW zIPk;%IrWaitP?r=MCh#tbk6zhZ#)2Zc)LIm|7Ztpgjn zK2p3$NP;%KB?y&6&tYy6BPha_BHB{no*2TGqhGl^&tY!SmV+=e<2Y_+;a(`h%#MC# z(m{9@xn%~Jfv*fK*lvZ+|HGf(|6hx^#|$t7bH#utwt|+AOLAxH%;M;*RjAjfB$St1 m{3t=g9L1PRNAV`A5%eoE5Iu*vMf9NXMZnO&4Kwhk47>yIBvR@C diff --git a/.gitignore b/.gitignore index faa1838..a0f0e53 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ .vscode - +.DS_Store From 020d7a2c04f17960c3f7642a2307675b5a07a625 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Wed, 2 Aug 2023 15:31:01 +0800 Subject: [PATCH 023/151] Delte mail_spam.html because it is not used. --- mail_spam.html | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 mail_spam.html diff --git a/mail_spam.html b/mail_spam.html deleted file mode 100644 index 7589930..0000000 --- a/mail_spam.html +++ /dev/null @@ -1,14 +0,0 @@ - \ No newline at end of file From 68f9db8e1d38963204bae1355ce155c1c51a0ced Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Thu, 3 Aug 2023 15:31:38 +0800 Subject: [PATCH 024/151] Make PHP having UTF-8 encoding. --- Admin.php | 552 ++++++++++++++++++++++++++-------------------------- Footer.php | 4 +- README.md | 4 +- Student.php | 28 +-- logout.php | 48 ++--- signup.php | 100 +++++----- 6 files changed, 368 insertions(+), 368 deletions(-) diff --git a/Admin.php b/Admin.php index bf39f0f..057783c 100644 --- a/Admin.php +++ b/Admin.php @@ -1,276 +1,276 @@ - - - - - - - - -
    -
    -

    Administration panel

    -
    - -
    -
    - -
    - - - -
    - - - - - -
    - -

    - - Create TA Accounts "; - - } - else if($_SESSION['user_type'] == "Admin"){ - echo "Create Lecturer Accounts "; - } - - ?> -
    - - Full Name - - Email - - - Passport Number / ID (Used as Initial Password) - -
    User Type : - - TA (Teaching Assistant) '; - - } - else if($_SESSION['user_type'] == "Admin"){ - - echo " Lecturer "; - - } - - ?> - -
    - - '; - $_SESSION['info_Admin_Users'] = null; - } - if (isset($_SESSION['info_Admin_Users'])) { - echo '
    '; - $_SESSION['info_Admin_Users'] = null; - } - - ?> - -
    - -
    - -
    - - - - - - - - -
    -
    - -
    - -
    - -
    - -
    - - - -
    - -
    - - + + + + + + + + +
    +
    +

    Administration panel

    +
    + +
    +
    + +
    + + + +
    + + + + + +
    + +

    + + Create TA Accounts "; + + } + else if($_SESSION['user_type'] == "Admin"){ + echo "Create Lecturer Accounts "; + } + + ?> +
    + + Full Name + + Email + + + Passport Number / ID (Used as Initial Password) + +
    User Type : + + TA (Teaching Assistant) '; + + } + else if($_SESSION['user_type'] == "Admin"){ + + echo " Lecturer "; + + } + + ?> + +
    + + '; + $_SESSION['info_Admin_Users'] = null; + } + if (isset($_SESSION['info_Admin_Users'])) { + echo '
    '; + $_SESSION['info_Admin_Users'] = null; + } + + ?> + +
    + +
    + +
    + + + + + + + + +
    +
    + +
    + +
    + +
    + +
    + + + +
    + +
    + + diff --git a/Footer.php b/Footer.php index 9dd24d1..adcac4a 100644 --- a/Footer.php +++ b/Footer.php @@ -1,2 +1,2 @@ -








    -
    +








    +
    diff --git a/README.md b/README.md index b48e53a..57af2eb 100644 --- a/README.md +++ b/README.md @@ -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 mnc -p lrr < lrr_database_dump.sql`. 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: diff --git a/Student.php b/Student.php index bcca070..0c137f6 100644 --- a/Student.php +++ b/Student.php @@ -1,14 +1,14 @@ - - -


    - -
    - -
    -

    Student account created. Now you can browse the course portal.

    -
    - -
    + + +


    + +
    + +
    +

    Student account created. Now you can browse the course portal.

    +
    + +
    diff --git a/logout.php b/logout.php index 8b98508..f8ffb17 100644 --- a/logout.php +++ b/logout.php @@ -1,24 +1,24 @@ - + diff --git a/signup.php b/signup.php index b5c7d3b..ef51d63 100644 --- a/signup.php +++ b/signup.php @@ -1,50 +1,50 @@ - - - - -
    - -
    - -
    - -

    Please fill in each field below

    -
    - -
    - -
    - - Full Name - - - Student ID - - - Email - - - Password (must include uppercase and lowercase letters, digits and special characters) - - - Confirm Password - -
    - - '; - $_SESSION['info_signup'] = null; - } - ?> -
    - -
    -
    -
    -
    + + + + +
    + +
    + +
    + +

    Please fill in each field below

    +
    + +
    + +
    + + Full Name + + + Student ID + + + Email + + + Password (must include uppercase and lowercase letters, digits and special characters) + + + Confirm Password + +
    + + '; + $_SESSION['info_signup'] = null; + } + ?> +
    + +
    +
    +
    +
    From a485c4eaf1ef114e507e7a5d602f232b09d00c91 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Thu, 3 Aug 2023 16:05:24 +0800 Subject: [PATCH 025/151] README.md: Add a section on solving the character-coding problem in the MySQL dump file. --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index 57af2eb..fa34c48 100644 --- a/README.md +++ b/README.md @@ -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). From dd0fc3a0052beec54dbbe39ca4a3fd6c6eb4d93a Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Thu, 3 Aug 2023 16:14:32 +0800 Subject: [PATCH 026/151] README.md: create database before import --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fa34c48..3d7f02c 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ LRR uses a database called `lrr`. So create this database using MySQL root acco 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.sql`, 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.sql`. 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. +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: From 954006ff0bf771eb4863ae6650d455fba6db53e0 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Thu, 3 Aug 2023 16:31:16 +0800 Subject: [PATCH 027/151] Make a student's Course Page look better. The first letter in a button name is uppercase, others are in lowercase. --- Course.php | 38 ++++++++++++++++---------------------- Script.php | 2 +- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/Course.php b/Course.php index ab8fb0d..4125a86 100644 --- a/Course.php +++ b/Course.php @@ -402,7 +402,7 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen if($status=='Marked') { $rm_data="\Script.php?remarking=yes&id=$Submission_ID&url=$url&status=Remarking"; - $remarking=""; + $remarking=""; } if($status=='Remarking') { @@ -412,7 +412,7 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen echo "
    - $title ($marks Marks out of $Originalmarks)
    Lecturer Feedback : $notes   $remarking
    Submission files :"; + $title ($marks Marks out of $Originalmarks)
    Lecturer Feedback : $notes   $remarking
    Submitted files :"; $Sub_result = 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`, @@ -462,7 +462,7 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
    -

    Class Groups

    +

    My groups

    DELETE GROUP"; + $extra4 = ""; echo "
    $name ($status) $extra $extra2 $extra3" . (($status == "Created")? "$extra4": "") @@ -524,8 +524,8 @@ where course_group_members_table.Course_Group_id=$id"); #Show group members + remove button next to each member except the creator of the group if($flag){ - echo "
  • $name-$Student_ID ($status)".(($status != "Created")?"":"")."
  • "; + echo "
  • $name - $Student_ID ($status) ".(($status != "Created")?"":"")."
  • "; }else{ echo "
  • $name-$Student_ID ($status)"; } @@ -555,18 +555,16 @@ include 'Footer.php'; try { $('
    \n\ - Group Name \n\ + Group name \n\
    ').dialog({ modal: true, - title:'Create Group', + title:'Create a group', buttons: { - 'Create Group': function () { + 'Create': function () { $('#frm').submit(); - $(this).dialog('close'); }, 'Cancel': function () { - $(this).dialog('close'); } @@ -583,7 +581,7 @@ include 'Footer.php'; try { $('
    \n\ - Enter Student_ID to Invite \n\ + Enter Student ID to invite \n\
    ').dialog({ modal: true, title:'Invite Students to Group', @@ -652,15 +650,13 @@ include 'Footer.php'; \n\ ').dialog({ modal: true, - title:'Remove '+student_id+'?', + title:'Kick out '+student_id+'?', buttons: { - 'Confirm': function () { + 'Yes': function () { $('#frm').submit(); - $(this).dialog('close'); }, - 'Cancel': function () { - + 'No': function () { $(this).dialog('close'); } @@ -681,13 +677,11 @@ include 'Footer.php'; modal: true, title:'Delete this group?', buttons: { - 'Confirm': function () { + 'Yes': function () { $('#frm').submit(); - $(this).dialog('close'); }, - 'Cancel': function () { - + 'No': function () { $(this).dialog('close'); } diff --git a/Script.php b/Script.php index 05545be..e011f4d 100644 --- a/Script.php +++ b/Script.php @@ -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 . "
    " . $con->error; From 6be090821087b1ee8de785b5777b6823f4ba18d7 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Fri, 4 Aug 2023 15:24:51 +0800 Subject: [PATCH 028/151] Make pages look better. List courses in descending order creation. --- Admin.php | 6 +++--- Course.php | 10 +++++----- Courses.php | 41 ++++++++++++++++++++--------------------- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/Admin.php b/Admin.php index 057783c..fd93d1e 100644 --- a/Admin.php +++ b/Admin.php @@ -77,14 +77,14 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") { ?>
    - Full Name + Full name Email - Passport Number / ID (Used as Initial Password) + Passport number/ID (used as the initial password) -
    User Type : +
    User type: - Courses > $name ($code) > Lab Reports
    Faculty: $faculty | Year: $academic | Lecturer: $lecturer -
  • "; + Courses > ($code) $name > Assignments
    Faculty: $faculty   Year: $academic   Lecturer: $lecturer +
    "; } else { $ta_name = ""; while ($row = mysqli_fetch_assoc($ta_result)) { @@ -138,7 +138,7 @@ if( $_SESSION['user_type'] == "Student") if(mysqli_num_rows($result1)==0) { - echo "No active assignments for this course so far."; + echo "No active assignments for this course now."; } else { while($row = mysqli_fetch_assoc($result1)) { @@ -406,13 +406,13 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen } if($status=='Remarking') { - $remarking=" Remarking Request sent
    Remarking Reason:$remarking_reason
    "; + $remarking=" Remarking request sent
    Reasons for remarking: $remarking_reason
    "; } echo "
    - $title ($marks Marks out of $Originalmarks)
    Lecturer Feedback : $notes   $remarking
    Submitted files :"; + $title ($marks marks out of $Originalmarks)
    Lecturer feedback: $notes   $remarking
    Submitted files :"; $Sub_result = 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`, diff --git a/Courses.php b/Courses.php index 0a2de79..e3401b7 100644 --- a/Courses.php +++ b/Courses.php @@ -85,7 +85,7 @@ if( $_SESSION['user_type']=="Lecturer" || $_SESSION['user_type']=="TA")
    ($code) - $name -
    Faculty: $faculty | Year: $academic | Lecturer: $lecturer +
    Faculty:$faculty   Year: $academic   Lecturer: $lecturer

    "; @@ -366,7 +366,7 @@ WHERE Course_ID=$course_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 where courses_table.Lecturer_User_ID=$user_d"); + . "`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 ORDER BY Academic_Year DESC, URL ASC"); if($_SESSION['user_type']=="TA") { @@ -412,7 +412,7 @@ where course_ta.Course_ID=$id");

    - Course Joining Requests + Course joining requests @@ -426,7 +426,7 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'" if(mysqli_num_rows($result)==0) { - echo "
    No course-joining request so far for all your courses
    "; + echo "
    No course-joining request so far for your courses
    "; } else { while($row = mysqli_fetch_assoc($result)) { $id=$row['ID']; @@ -453,7 +453,7 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'" } if( $_SESSION['user_type']=="Lecturer"){ ?> - Create new Course Portal + Create a new course @@ -482,7 +482,7 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'" No
    -
    +
    @@ -537,7 +537,7 @@ if( $_SESSION['user_type']=="Student") // the user has not entered something under "Find course by Code" if($faculty=="") { - echo "

    Search Results for Course Code $search


    "; + echo "

    Search results for course code: $search


    "; $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" @@ -546,7 +546,7 @@ if( $_SESSION['user_type']=="Student") // the user has entered something under "Find course by Code" else { - echo "

    Find Courses under faculty $faculty

    "; + echo "

    Find courses under faculty: $faculty

    "; $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 @@ -556,7 +556,7 @@ if( $_SESSION['user_type']=="Student") if(mysqli_num_rows($result)==0) { - echo "No results found ...
    "; + echo "No results.
    "; } else { @@ -569,7 +569,6 @@ if( $_SESSION['user_type']=="Student") $url=$row['URL']; $id=$row['Course_ID']; $v=$row['Verify_New_Members']; - $msg2="Join Course"; if($v>0) { $msg=" Lecturer verification required"; @@ -577,25 +576,25 @@ if( $_SESSION['user_type']=="Student") } echo "
    - [$code] $name
    ($url)
    $msg2 -
    Faculty: $faculty | Year: $academic | Lecturer: $lecturer
    $msg
    + ($code) $name
    ($url)
    Join +
    Faculty: $faculty   Year: $academic   Lecturer: $lecturer
    $msg
    "; } } } // Otherwise, list the student's joined courses (already done), in reverse chronological order - echo "

    My Courses

    "; + echo "

    My courses

    "; $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"); + where course_students_table.Student_ID=$student_id ORDER BY Academic_Year DESC, URL ASC"); if(mysqli_num_rows($result)==0) { - echo " You are not Enrolled in any Course"; + echo " You are not enrolled in any Course"; } else { while($row = mysqli_fetch_assoc($result)) { $name=$row['Course_Name']; @@ -610,15 +609,15 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl if($Status=="Joined") { echo "
    - ($code) - $name
    ($url)     $Status     
    Open -
    Faculty : $faculty Year : $academic Lecturer :$lecturer
    + ($code) - $name
    ($url)     $Status      +
    Faculty: $faculty   Year: $academic   Lecturer: $lecturer
    "; } else { echo "
    ($code) - $name $Status -
    Faculty : $faculty Year : $academic Lecturer :$lecturer
    +
    Faculty: $faculty   Year: $academic   Lecturer: $lecturer
    "; } } @@ -628,9 +627,9 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl
    -
    -
    Find course by course code - +
    +
    Find new course by course code +
    List courses by faculty From da6ffcf3063ddcbe7a23ea01e738de6cfc9a4b36 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Fri, 4 Aug 2023 18:14:05 +0800 Subject: [PATCH 029/151] If a user has already logged in, he will not see the login page again after he clicks the LRR logo. --- Courses.php | 11 ++--------- Header.php | 2 +- index.php | 2 ++ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Courses.php b/Courses.php index e3401b7..33df546 100644 --- a/Courses.php +++ b/Courses.php @@ -358,12 +358,7 @@ WHERE Course_ID=$course_id"); - Course Portal > $user_name (Lecturer) > Course Listing -
    -
    - "; - + echo "
    My courses
    "; $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 ORDER BY Academic_Year DESC, URL ASC"); @@ -376,8 +371,6 @@ INNER JOIN course_ta ON course_ta.Course_ID=courses_table.Course_ID where course_ta.TA=$user_d"); } - // $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)) { @@ -464,7 +457,7 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'" Course code - URL (Leave blank to use Course Code & Year) + URL (leave blank to use course code & year) Academic year diff --git a/Header.php b/Header.php index d29f199..4cfa46f 100644 --- a/Header.php +++ b/Header.php @@ -18,7 +18,7 @@ if (mysqli_connect_errno()) { - LRR - Lab Report Repository + Lab Report Repository
    -
    Course Portal > Students
    +
    -
    -
    Find new course by course code - -
    -List courses by faculty +
    +
    +
    + Find new course by course code + +
    -"; $result = mysqli_query($con,"SELECT DISTINCT(Faculty) as Faculty FROM `courses_table`"); if(mysqli_num_rows($result)==0){ - } else { - echo""; + echo" "; while($row = mysqli_fetch_assoc($result)) { $fname=$row['Faculty']; - echo " "; + echo " "; }} - echo "
    + echo " +
    -
    -

    - +

    + +
    +
    +
    - -
    "; diff --git a/Script.php b/Script.php index e011f4d..af52ea7 100644 --- a/Script.php +++ b/Script.php @@ -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:
    " . $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 . "
    " . $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 . "
    " . $con->error; diff --git a/Submissions.php b/Submissions.php index 63ddfbf..211c9da 100644 --- a/Submissions.php +++ b/Submissions.php @@ -137,7 +137,7 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Sub } 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']; @@ -159,7 +159,7 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Sub $student_id = $row['sub_std']; if ($submitted_group == 0) { - $submitted_by = $student_name . "(" . $student_id . ")"; + $submitted_by = $student_name . " (" . $student_id . ")"; } else { $submitted_by = "$student_name ($submitter_student_number) for group $groupname "; } @@ -220,7 +220,7 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Marked' Order by lab echo "No Marked submissions for this lab"; } else { - echo "

    Export Grade Sheet

    "; + echo "

    Export grades

    "; while ($row = mysqli_fetch_assoc($result)) { $title = $row['Title']; @@ -304,7 +304,7 @@ 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']; @@ -350,7 +350,7 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'"); $title
    by : $submitted_by        [ Marked $Marks ]
    Remarking Reason : $remarking_reason
    Submitted : $posted " . "" - . "       Ignore Request " + . "      Ignore request" . "
    Attachments : $full_link
    "; } @@ -362,7 +362,7 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");