diff --git a/.gitignore b/.gitignore index faa1838..a0f0e53 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ .vscode - +.DS_Store diff --git a/Admin.php b/Admin.php index 8280aa5..3234bf3 100644 --- a/Admin.php +++ b/Admin.php @@ -1,293 +1,266 @@ - - - - - - - - - - -
-
-

Administration Panel

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

Lecturer Account Management

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

- - 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; - } - - ?> - -
- -
- -
- - - - - - - -
-
- -
- -
- -
- - - - - -
- - - -
- -
- - \ No newline at end of file + + + + + + + +
+ + +
+

Administration panel

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

Copy & paste student number to the following box, and separate two student numbers with a space.

+
+ + +
+
+ +

+ + Create TA Accounts

"; + } + else if($_SESSION['user_type'] == "Admin"){ + echo "

Create Lecturer Accounts

"; + } + + ?> +
+ + Full name +
+ Email +
+ Initial password + + + Leave it empty to let LRR generate a strong password for you.

+ 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; + } + ?> + +
+ +
+ + +

+ + + + + + + + + + Reset"; + if ($row['Status'] == "Active") { + $newstatus = "Blocked"; + $btnBlock = ""; + } else { + $newstatus = "Active"; + $btnBlock = ""; + } + + echo ""; + } + ?> +
IDNameEmailReset password Block/Activate
" . $row['User_ID'] . "" . $row['Full_Name'] . "" . $row['Email'] . "$btn$btnBlock
+
+ +
+ +
+ +
+ + + +

+ +

Past courses

+ + + + + + + + + + + + "; + } + } + ?> + +
Course nameFacultyLecturerTAsAssign a new TA
$code - $name $faculty $lecturer$ta
+ +
+ +
+ +
+ +
+ + + + + + + + + diff --git a/Course.php b/Course.php index 5dc8583..2f50ff4 100644 --- a/Course.php +++ b/Course.php @@ -1,4 +1,6 @@ @@ -6,760 +8,728 @@ include 'NoDirectPhpAcess.php'; + +
+ + - Courses > $name ($code) > Lab Reports
Faculty: $faculty | Year: $academic | Lecturer: $lecturer -
"; - } else { - $ta_name = ""; - while ($row = mysqli_fetch_assoc($ta_result)) { - $ta_name = $ta_name.$row['Full_Name']." "; - } - $ta_name = trim ($ta_name); - echo "
- Courses > $name ($code) > Lab Reports
Faculty: $faculty | Year: $academic | Lecturer: $lecturer | Teaching Assistant: $ta_name -
"; + echo "No course matching the given course URL: ".$course_url; + + } 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']; + $course_id = $row['Course_ID']; + // also get teaching assistant names (if any) + $ta_result = mysqli_query($con, "SELECT Full_Name FROM users_table WHERE User_ID IN (SELECT TA FROM course_ta WHERE Course_ID='$course_id');"); + if (mysqli_num_rows($ta_result) == 0) { + echo "
+ Courses > ($code) $name > Assignments
+ Faculty: $faculty   Year: $academic   Lecturer: $lecturer +
"; + } else { + $ta_name = ""; + while ($row = mysqli_fetch_assoc($ta_result)) { + $ta_name = $ta_name.$row['Full_Name']." "; + } + $ta_name = trim($ta_name); + echo "
+ Courses > ($code) $name > Assignments
+ Faculty: $faculty   Year: $academic   Lecturer: $lecturer   Teaching Assistant: $ta_name +
"; + } } - } + } } -} -?> + ?> + + + ' . $_SESSION['info_general'] . ''; + $_SESSION['info_general'] = null; + } + + if (isset($_SESSION['info_courses'])) { + echo '
' . $_SESSION['info_courses'] . '
'; + $_SESSION['info_courses'] = null; + } + ?> + + + +
+ +
+ + + + + +
+ + + + + + + + + + + + + + + + +
+
+ +
+ +

My groups

+ + Create group"; + ?> + +
+ + Invite member "; + + if($status == "Invited") + { + $extra2 = " Accept"; + $extra3 = " Decline"; + } + + echo ""; + } + } + ?> +
+ +
+ + -
- -'; - $_SESSION['info_general']=null; -} - -if (isset($_SESSION['info_courses'])) { - echo '
'; - $_SESSION['info_courses']=null; -} -?> -
+ + + - -
- -
- -
- - - - - -
- - - - - - - - - - - - - - - - - - - - -
- -
- -
-

Class Groups

- - Create Group"; - - ?> - - - -
- 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, - 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"; - - 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)"; - } - - } - - - - - - - - } - } - ?> - - - - - -
  • - -
    - - - - - - - - - - - + + + + diff --git a/Courses.php b/Courses.php index 5bba2fc..9e6d10f 100644 --- a/Courses.php +++ b/Courses.php @@ -1,113 +1,103 @@ -$user_d = $_SESSION['user_id']; +
    -if( $_SESSION['user_type']=="Lecturer" || $_SESSION['user_type']=="TA") -{ + + - +
    + + + -
    - - - - - - - - - - -
    - ($code) - $name -
    Faculty: $faculty | Year: $academic | Lecturer: $lecturer -
    -
    - "; - - echo "
    "; + + + 0) { + 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']; + $course_id = $row['Course_ID']; + echo "

    ($code) - $name

    +
    + Faculty: $faculty    Year: $academic    Lecturer: $lecturer +
    +
    "; + echo "
    "; + } + + // ------------------------------Editing Lab Assignment by Lecturer ------------------------------------ - if($_GET['act']=="edit"){ + 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) ); @@ -117,8 +107,8 @@ New Date/Time
    query($sql) === TRUE) { $_SESSION["info_Updated"]="Assignment information updated successfully."; - } else { - // echo "Error: " . $sql . "
    " . $con->error; - echo "Serious error happened whiling updating assignment information."; + echo "Serious error happened while updating assignment information."; } } - - if( $_SESSION['user_type']=="Lecturer"){ + + if (isset($_POST['form_deletelab'])) { + $sql = "DELETE FROM lab_reports_table WHERE Lab_Report_ID='$getid'"; + if ($con->query($sql) === TRUE) { + $_SESSION["info_Updated"]="Assignment deleted successfully."; + } else { + echo "Serious error happened while deleting the assignment."; + } + } + + + if ($_SESSION['user_type'] == "Lecturer") { $Date = $_SESSION['Date']; $Time = $_SESSION['Time']; $Instructions = $_SESSION['Instructions']; $Title = $_SESSION['Title']; $Marks = $_SESSION['Marks']; $Type = $_SESSION['Type']; - - echo "

    Editing Lab Assignment

    "; - ?> -
    - + echo "

    Edit assignment information

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



    +
    + +
    +
    + -
    -



    - - if( $_SESSION['user_type']=="Lecturer"){ +

    New assignment

    - ?> - -

    Post new Lab Assignment

    - -
    - - + + + - - Deadline Date/Time -
    -
    -
    + + Deadline (date and time) +
    +
    +
    Title - - Instructions - - Marks - + + Instruction + + Mark + Attachment 1 - - + Attachment 2 - - + Attachment 3 - - - + Attachment 4 - +
    - Submission Type Individual + Submission type: Individual - Group + Group
    -
    -



    -"; - - echo "

    Lab Report Assignment list

    "; - - error_reporting(0); - if(isset($_SESSION["info_Updated"])){ - echo '
    '; - $_SESSION['info_Updated'] = null; +
    +



    + '; - $_SESSION['info_courses'] = null; - } - if (isset($_SESSION['info_courses'])) { - echo '
    '; - $_SESSION['info_courses']=null; - } - - - - - $result = mysqli_query($con," SELECT `Lab_Report_ID`,Type,Marks, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, `Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, " - . "`Attachment_link_4` FROM `lab_reports_table` WHERE Course_ID=$id ORDER by Lab_Report_ID DESC"); - - - if( $_SESSION['user_type']=="TA") - { - echo "*Only Lecturer can post a new lab report assignment
    "; - } - if(mysqli_num_rows($result)==0) - { - echo "No assignments posted so far."; - - } else { while($row = mysqli_fetch_assoc($result)) { - $marks=$row['Marks']; - $title=$row['Title']; - $ins=$row['Instructions']; - $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
    " - . "  
    - "; - - - - }} - 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`, - `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"); - - - 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" - -
    - ($code) - $name -
    Faculty : $faculty        Year : $academic        Lecturer :$lecturer        TA:$ta -
    - "; - - }}?> -
    -
    -
    - 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 "
    - $std_name is Requesting to join
    [($code) - $name ]     
    Accept -    Decline -
    "; - - - } - } - ?> + echo "
    "; + echo "

    Assignment list

    "; + error_reporting(0); + if (isset($_SESSION["info_Updated"])) { + echo '
    '; + $_SESSION['info_Updated'] = null; + } + if (isset($_SESSION['info_courses'])) { + echo '
    '; + $_SESSION['info_courses'] = null; + } + if (isset($_SESSION['info_courses'])) { + echo '
    '; + $_SESSION['info_courses']=null; + } + if( $_SESSION['user_type'] == "TA") { + echo "Only Lecturer can post assignments.
    "; + } + $result = mysqli_query($con, "SELECT Lab_Report_ID, Type, Marks, Course_ID, Posted_Date, Deadline, Instructions, Title, Attachment_link_1, Attachment_link_2, Attachment_link_3, Attachment_link_4 + FROM lab_reports_table + WHERE Course_ID=$id ORDER BY Lab_Report_ID DESC"); + if(mysqli_num_rows($result)==0) { + echo "No assignments posted so far."; + } else { + while ($row = mysqli_fetch_assoc($result)) { + $marks = $row['Marks']; + $title = $row['Title']; + $ins = $row['Instructions']; + $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"; + } - -Only Lecturers can Post new Lab report Assignments"; - } - if( $_SESSION['user_type']=="Lecturer"){ ?> - - Create new Course Portal - -
    - - - Course Name - + $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']; + } - Course Code - + $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']; + } + } - URL (Leave blank to use Course Code & Year) - + $header="Courses > ".$name."($code) > Assignments > ".$title; - Academic Year - + echo "
    +
    +
    $title ($marks Marks, $as_type)
    +
    $ins
    +

    Posted: $posted    Deadline: $deadline

    +

    $count_subs Submissions ( $count_marked Marked )

    + Edit + View + Extend Deadline +

    Attachments: $full_link

    +
    +
    "; - Faculty
    - - - - - - - Verify Joining Students - Yes - No - -
    -
    - -
    - - - -
    - - - - - - - -
    -
    -
    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`, - `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
    "; - - } 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` -INNER JOIN users_table - ON users_table.User_ID=courses_table.Lecturer_User_ID + echo "
    "; -INNER JOIN course_students_table on course_students_table.Course_ID=courses_table.Course_ID + $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"); - 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 "
    - ($code) - $name
    ($url)     $Status     
    Open -
    Faculty : $faculty Year : $academic Lecturer :$lecturer
    - "; + echo ""; + return; + } + + ?> + + + +
    + + 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_id + ORDER BY Academic_Year DESC, URL ASC"); + + if ($_SESSION['user_type'] == "TA") { + $result = mysqli_query($con, "SELECT course_ta.Course_ID, Course_Name, Academic_Year, Faculty, Lecturer_User_ID, TA_User_ID, Course_Code, URL, Verify_New_Members + FROM courses_table + INNER JOIN course_ta ON course_ta.Course_ID=courses_table.Course_ID + WHERE course_ta.TA=$user_id"); + } + + if (mysqli_num_rows($result) != 0) { + 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']; + } + + if ($ta == "") { + $ta = " None"; + } + + + echo" +
    + ($code) - $name +

    Faculty: $faculty        Year: $academic        Lecturer: $lecturer        TA:$ta

    +
    +
    "; + } + } + ?> + +
    +
    +
    + Course joining requests + + No course-joining request so far for your courses
    "; + } else { + while ($row = mysqli_fetch_assoc($result)) { + $id = $row['ID']; + $name = $row['Course_Name']; + $code = $row['Course_Code']; + $faculty = $row['Faculty']; + $student_name = $row['Full_Name']; + $academic = $row['Academic_Year']; + echo "
    - ($code) - $name $Status -
    Faculty : $faculty Year : $academic Lecturer :$lecturer
    - "; + $student_name is Requesting to join
    [($code) - $name ]     
    + Accept    Decline +
    "; + } + } + ?> + + + Only Lecturer can post assignments"; + } + + if ($_SESSION['user_type'] == "Lecturer"){ + ?> + + Create a new course + +
    + + + Course name + + + Course code + + + URL (leave blank to use course code & year) + + + Academic year + + + Faculty
    + + + + + Verify joining students? + Yes + No + +

    +
    + +
    + + + +
    + + + + + + +
    +
    + + ' . $_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"); + } else if ($faculty != "") { // the user has entered something under "Find course by Code" + 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.
    "; + } 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']; + if($v > 0) { + $msg = " Lecturer verification required"; + $msg2 = "Send Joining Request"; + } + + echo "
    + ($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

    "; + $result = mysqli_query($con, "SELECT users_table.Full_Name, course_students_table.Status, courses_table.Course_ID, Course_Name, Academic_Year, Faculty, Lecturer_User_ID, TA_User_ID, Course_Code, URL, Verify_New_Members + FROM courses_table + INNER JOIN users_table ON users_table.User_ID=courses_table.Lecturer_User_ID + INNER JOIN course_students_table ON course_students_table.Course_ID=courses_table.Course_ID + WHERE course_students_table.Student_ID=$student_id ORDER BY Academic_Year DESC, URL ASC"); + + 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_year = $row['Academic_Year']; + $url = $row['URL']; + $id = $row['Course_ID']; + $status = $row['Status']; + if($status == "Joined") { + echo " +
    + ($code) $name
    + ($url)     $status     
    + Faculty: $faculty   Year: $academic_year   Lecturer: $lecturer +
    +
    "; + } else { + echo "
    + ($code) $name $status
    + Faculty: $faculty   Year: $academic_year   Lecturer: $lecturer +
    "; + } + } + } + + echo "
    + +
    +
    +
    +
    +
    + Find new course by course code + +
    + +
    + List courses by faculty + -
    -List courses by faculty - +
    - } else { - echo""; - while($row = mysqli_fetch_assoc($result)) { - $fname=$row['Faculty']; - echo " "; - }} +

    + +
    +
    +
    +
    +
    +
    "; - echo "
    + } + + ?> + + + +
    -

    - -
    - -
    - - - - - - -
    "; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} - -?> - - - - - - - - - - - - - - - + diff --git a/Download.php b/Download.php index d59e90e..42db7d4 100644 --- a/Download.php +++ b/Download.php @@ -25,7 +25,7 @@ $type = filetype($file); $today = date("F j, Y, g:i a"); $time = time(); -if ((isset($_SESSION["user_student_id"]) && strpos($file, $_SESSION["user_student_id"]) > 0) || $_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "TA" ) { +if ((isset($_SESSION["user_student_id"]) && (strpos($file, $_SESSION["user_student_id"]) > 0 || strpos($file, "Lab_Report_Assignments"))) || $_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "TA" ) { // 发送文件头部 header("Content-type: $type"); header('Content-Disposition: attachment;filename="'.urldecode($filename).'"'); diff --git a/Footer.php b/Footer.php index de442d2..292966d 100644 --- a/Footer.php +++ b/Footer.php @@ -1,4 +1,3 @@ -








    -
    - -
    \ No newline at end of file +Copyright © 2018-" . date("Y") . " The Authors

    "; +?> diff --git a/Header.php b/Header.php index 63ad2ce..6531bc6 100644 --- a/Header.php +++ b/Header.php @@ -3,175 +3,199 @@ session_start(); error_reporting(0); date_default_timezone_set('Asia/Shanghai'); -include "get_mysql_credentials.php"; -$con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr"); +//include "get_mysql_credentials.php"; +$mysql_host= "localhost"; +$mysql_username = "root"; +$mysql_password = ""; +$mysql_db = "lrr"; +// $mysql_username, $mysql_password variable declared directly +$con = mysqli_connect($mysql_host,$mysql_username,$mysql_password,$mysql_db); // Check database connection -if (mysqli_connect_errno()) { - echo "Failed to connect to MySQL: " . mysqli_connect_error(); -} +if (mysqli_connect_errno()) { + echo "Failed to connect to MySQL: " . mysqli_connect_error(); +} ?> - + - + + + + LRR - - - - - + + - - - + + + + + - + - h1, - h2, - h3, - h4 { - color: #03407B; - } + - a { - color: #03407B; - } + - .break-word { - word-wrap: break-word; - white-space: -moz-pre-wrap !important; - /* Mozilla, since 1999 */ - white-space: -pre-wrap; - /* Opera 4-6 */ - white-space: -o-pre-wrap; - /* Opera 7 */ - white-space: pre-wrap; - /* css-3 */ - word-wrap: break-word; - /* Internet Explorer 5.5+ */ - white-space: -webkit-pre-wrap; - /* Newer versions of Chrome/Safari*/ - word-break: break-all; - white-space: normal; - } + + + + diff --git a/NoDirectPhpAcess.php b/NoDirectPhpAcess.php index 4e85779..3552229 100644 --- a/NoDirectPhpAcess.php +++ b/NoDirectPhpAcess.php @@ -1,7 +1,7 @@ diff --git a/README.md b/README.md index b48e53a..3d7f02c 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 username -p lrr < lrr_database_dump.sql`. You must create database `lrr` first on your computer before doing the import. Read [How to Import and Export MySQL Databases in Linux](https://phoenixnap.com/kb/import-and-export-mysql-database) for more detail. Do not have lrr_database_dump.sql? You can use lrr_database.sql in this repo instead. LRR also needs to store assignment submissions. We store them in a folder called `../../lrr_submission`. Note that `lrr_submission` is two levels above the project folder (where many PHP files reside). I copied this folder from the existing one. I think it is also OK if you create an empty folder. We need to set a proper owner and accessibility for `lrr_submission` using the following two commands: @@ -51,6 +51,31 @@ Enable the site lrr: `sudo a2ensite lrr`. Restart the apache server: `sudo syst Visit the LRR application by entering this URL in a web browser: http://121.4.94.30/. +### Solving the coding problems in the dump file + +If the database contains Chinese characters, the dump file (e.g., lrr_database_dump.sql) may contain *weird* characters, e.g., `研究生`, so weird that no one can tell their meaning. + +We need to correct these abnormal characters before we import them to the new database, so that the PHP program can correctly display Chinese information. + +The simplest solution is using the ftfy (fixes text for you) Python package to convert them, as follows: + +``` +from ftfy import fix_text + +with open('lrr_database_dump.sql') as f: + content = f.read() + +content2 = fix_text(content) +with open('lrr_database_dump_sql_fixed.txt', 'w') as f: + f.write(content2) +``` + +Now, import data using lrr_database_dump_sql_*fixed*.txt. + +If you encounter the 'Unknown MySQL server host' problem during import, replace all apostrophes with a space in the dump file. For example, if a database table field contains *can't*, then the apostrophe between *n* and *t* can cause that problem. + + + ## Enock steps Enock, a graduate student here, has made a tutorial about how he deployed LRR to a remote server (http://lanlab.org/course/2021s/spm/PuTTY-Server.txt). diff --git a/Reset_password.php b/Reset_password.php deleted file mode 100644 index d08d9ab..0000000 --- a/Reset_password.php +++ /dev/null @@ -1,49 +0,0 @@ - - -
    - -
    - -
    - -

    Reset your password

    -
    - -
    -
    - - - Email - -
    - New Password - - -
    - -
    - -
    -
    - -
    -
    - -
    - - - diff --git a/Script.php b/Script.php index c0bfd7e..16df7d3 100644 --- a/Script.php +++ b/Script.php @@ -1,7 +1,19 @@ + query($sql) === TRUE) { - $_SESSION["info_Admin_Users"] = $type . " user created successfully. Use email " . $email . " as account name and $password as password."; + // $file_name = $email.'.txt'; + $_SESSION["info_Admin_Users"] = $type . " user created successfully. Use email " . $email . " as account name and ". $password ." as password."; + // file_put_contents('./acounts/'.$file_name, $_SESSION["info_Admin_Users"]); + //downloadFile($email); header("Location: Admin.php"); + } else { - echo "Error: " . $sql . "
    " . $con->error; + alert("Error: " . $sql . "
    " . $con->error); } + +} + +// ### FUNCTION TO GENERATE INITIAL PASSWORDS ###// +function generateStrongPassword() { + + $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_'; + $password_length = 12; + $gen_password = ''; + for ($i = 0; $i < $password_length; $i++) { + $random_index = mt_rand(0, strlen($characters) - 1); + $gen_password .= $characters[$random_index]; + } + + // Return the generated password + return $gen_password; } // #### FUNCTION CHECK FILE TYPES //// @@ -340,7 +392,7 @@ function mkdirs($path) } // ############################### #Post Assignment ################################## -if (!empty($_POST["frm_uploadlab"])) { +if (!empty($_POST["form_uploadlab"])) { $course_id = mysqli_real_escape_string($con, $_POST["course_id"]); $deadlinedate = $_POST["deadlinedate"]; @@ -357,7 +409,7 @@ if (!empty($_POST["frm_uploadlab"])) { // GET UPLOADED FILES - $target_dir = Create_dir("Lab_Report_Assignments/" . $title . "/"); + $target_dir = Create_dir("./../../lrr_submission/Lab_Report_Assignments/$course_id/" . $title . "/"); $rnd = rand(10, 1000); $rnd = ""; // no more required , creating folder for each lab @@ -416,16 +468,16 @@ if (!empty($_POST["frm_uploadlab"])) { $targetfile4 = ""; if ($_FILES['attachment1']['name'] != "") { - $targetfile = "/" . $title . "/" . $_FILES['attachment1']['name']; + $targetfile = "/Lab_Report_Assignments/$course_id/" . $title . "/" . $_FILES['attachment1']['name']; } if ($_FILES['attachment2']['name'] != "") { - $targetfile2 = "/" . $title . "/" . $_FILES['attachment2']['name']; + $targetfile2 = "/Lab_Report_Assignments/$course_id" . $title . "/" . $_FILES['attachment2']['name']; } if ($_FILES['attachment3']['name'] != "") { - $targetfile3 = "/" . $title . "/" . $_FILES['attachment3']['name']; + $targetfile3 = "/Lab_Report_Assignments/$course_id" . $title . "/" . $_FILES['attachment3']['name']; } if ($_FILES['attachment4']['name'] != "") { - $targetfile4 = "/" . $title . "/" . $_FILES['attachment4']['name']; + $targetfile4 = "/Lab_Report_Assignments/$course_id" . $title . "/" . $_FILES['attachment4']['name']; } $sql = "INSERT INTO `lab_reports_table`(`Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, @@ -434,7 +486,7 @@ if (!empty($_POST["frm_uploadlab"])) { if ($con->query($sql) === TRUE) { - $_SESSION["info_courses"] = $type . " lab report assignment posted successfully."; + $_SESSION["info_courses"] = $type . " lab report assignment posted successfully. "; header("Location: Courses.php?course=" . $url); } else { echo "Error: " . $sql . "
    " . $con->error; @@ -452,7 +504,7 @@ function checksize($file) } // ############################### Submit Assignment ################################## -if (!empty($_POST["frm_submitlab"])) { +if (!empty($_POST["form_submitlab"])) { $lab_id = mysqli_real_escape_string($con, $_POST["lab_id"]); $student_id = $_POST["student_id"]; @@ -585,7 +637,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 +700,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 +744,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; @@ -815,7 +867,7 @@ if (!empty($_GET["acceptinvite"])) { } if ($con->query($sql) === TRUE) { - $_SESSION["info_general"] = " Group Invite Updated"; + $_SESSION["info_general"] = " Group invitation status updated"; header("Location: Course.php?url=" . $url); } else { echo "Error: " . $sql . "
    " . $con->error; @@ -833,7 +885,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; @@ -867,7 +919,7 @@ if (!empty($_GET["extenddeadline"])) { $time = mysqli_real_escape_string($con, $_GET["time"]); $type = mysqli_real_escape_string($con, $_GET["type"]); - $stdid = mysqli_real_escape_string($con, $_GET["stdid"]); + $studentid = mysqli_real_escape_string($con, $_GET["studentid"]); $reason = mysqli_real_escape_string($con, $_GET["reason"]); $url = mysqli_real_escape_string($con, $_GET["url"]); $deadline = $date . " " . $time; @@ -877,12 +929,12 @@ if (!empty($_GET["extenddeadline"])) { } else { $sql = "INSERT INTO `extended_deadlines_table`(`Student_ID`, " . "`Lab_Report_ID`, `Extended_Deadline_Date`," - . " `ReasonsForExtension`) VALUES ('$stdid','$id','$deadline','$reason')"; + . " `ReasonsForExtension`) VALUES ('$studentid','$id','$deadline','$reason')"; } if ($con->query($sql) === TRUE) { - $_SESSION["info_courses"] = " Lab Report Deadline extended successfully."; + $_SESSION["info_courses"] = " Assignment deadline extended successfully."; header("Location: Courses.php?course=" . $url); } else { echo "Error: " . $sql . "
    " . $con->error; @@ -903,7 +955,7 @@ if (!empty($_GET["ignoreremarking"])) { if ($con->query($sql) === TRUE) { - $_SESSION["info_Marking"] = "Remarking Request Ignored , Submission Updated to 'Marked' status"; + $_SESSION["info_Marking"] = "Remarking request ignored."; header("Location: Submissions.php?id=" . $id . "&header=" . $header . "&total=" . $total); } else { echo "Error: " . $sql . "
    " . $con->error; @@ -987,20 +1039,19 @@ if (!empty($_GET["action"])) { } } - if ($action == "statuschange" && $_SESSION['user_id'] == $uid && ($_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "Admin")) { + if ($action == "statuschange" && ($_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "Admin")) { $sql = "UPDATE users_table set Status='$status' where User_ID='$uid';"; if ($con->query($sql) === TRUE) { $_SESSION["info_Admin_Users"] = $type . " user Status updated successfully "; header("Location: Admin.php"); } else { - // echo "Error: " . $sql . "
    " . $con->error; echo "Something really bad happened while changing status. Contact lanhui at zjnu.edu.cn. Thanks!"; } } } // ############################### CREATE STUDENT USER ################################## -if (!empty($_POST["frm_createCourse"])) { +if (!empty($_POST["form_createCourse"])) { $name = mysqli_real_escape_string($con, $_POST["name"]); $academic = mysqli_real_escape_string($con, $_POST["academic"]); $lecturer = mysqli_real_escape_string($con, $_POST["lecturer"]); @@ -1096,3 +1147,4 @@ WHERE lab_report_submissions.Lab_Report_ID='$lab'"; header("Expires: 0"); print "$header\n$data"; } +?> diff --git a/Student.php b/Student.php index 4541fc5..0c137f6 100644 --- a/Student.php +++ b/Student.php @@ -1,15 +1,14 @@ - - -


    - -
    - -
    -

    Student Account Created. Now you can Browse Course Portals

    -
    - -
    \ No newline at end of file + + +


    + +
    + +
    +

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

    +
    + +
    diff --git a/Submissions.php b/Submissions.php index 3df7614..5d1a431 100644 --- a/Submissions.php +++ b/Submissions.php @@ -1,4 +1,5 @@ @@ -24,22 +25,26 @@ if (!empty($_GET["total"])) { $total = 0; } -$resultx1 = mysqli_query($con, "SELECT `Lab_Report_ID`,Title, lab_reports_table.Course_ID, `Posted_Date`, `Deadline`, `Marks`, `Type` , courses_table.URL FROM `lab_reports_table` INNER JOIN courses_table ON courses_table.Course_ID=lab_reports_table.Course_ID WHERE Lab_Report_ID=$id"); +$resultx1 = mysqli_query($con, "SELECT Lab_Report_ID, Title, lab_reports_table.Course_ID, Posted_Date, Deadline, Marks, Type, courses_table.URL + FROM lab_reports_table + INNER JOIN courses_table ON courses_table.Course_ID=lab_reports_table.Course_ID + WHERE Lab_Report_ID=$id"); while ($row = mysqli_fetch_assoc($resultx1)) { - $Report_Type = $row['Type']; + $report_type = $row['Type']; $c_id = $row['Course_ID']; - $Report_Title = $row['Title']; + $report_title = $row['Title']; $url = $row['URL']; } - -echo "
    - $header -
    - "; - ?> -
    +
    + + $header
    "; +?> + + +
    '; + echo '
    ' . $_SESSION['info_Marking'] . '
    '; $_SESSION['info_Marking'] = null; } - $resultx1 = mysqli_query($con, "Select Count(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id"); - while ($row = mysqli_fetch_assoc($resultx1)) { - $count_subs = $row['cnt']; - } + $resultx1 = mysqli_query($con, "SELECT Count(*) AS cnt FROM lab_report_submissions WHERE lab_report_submissions.Lab_Report_ID=$id"); + $row = mysqli_fetch_assoc($resultx1); + $count_submissions = $row['cnt']; - $resultx2 = mysqli_query($con, "Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Marked'"); - if (mysqli_num_rows($resultx2) == 0) { - $count_marked = 0; - } else { - while ($row = mysqli_fetch_assoc($resultx2)) { - $count_marked = $row['cnt']; - } - } + $resultx2 = mysqli_query($con, "SELECT COUNT(*) AS cnt FROM lab_report_submissions WHERE lab_report_submissions.Lab_Report_ID=$id and Status='Marked'"); + $row = mysqli_fetch_assoc($resultx2); + $count_marked = $row['cnt']; - $resultx3 = mysqli_query($con, "Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Pending'"); - if (mysqli_num_rows($resultx3) == 0) { - $count_unmarked = 0; - } else { - while ($row = mysqli_fetch_assoc($resultx3)) { - $count_unmarked = $row['cnt']; - } - } + $resultx3 = mysqli_query($con, "SELECT COUNT(*) AS cnt FROM lab_report_submissions WHERE lab_report_submissions.Lab_Report_ID=$id and Status='Pending'"); + $row = mysqli_fetch_assoc($resultx3); + $count_unmarked = $row['cnt']; - $resultx4 = mysqli_query($con, "Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Remarking'"); - if (mysqli_num_rows($resultx4) == 0) { - $count_remark = 0; - } else { - while ($row = mysqli_fetch_assoc($resultx4)) { - $count_remark = $row['cnt']; - } - } + $resultx4 = mysqli_query($con, "SELECT COUNT(*) AS cnt FROM lab_report_submissions WHERE lab_report_submissions.Lab_Report_ID=$id and Status='Remarking'"); + $row = mysqli_fetch_assoc($resultx4); + $count_remark = $row['cnt']; + + $resultx5 = mysqli_query($con, "SELECT COUNT(*) AS cnt FROM course_groups_table WHERE Course_id=$c_id"); + $row = mysqli_fetch_assoc($resultx5); + $count_group = $row['cnt']; ?> - Lab Report Submissions () +
    +

    Total submissions ()

    -
    - - - diff --git a/logout.php b/logout.php index 7ff6624..f8ffb17 100644 --- a/logout.php +++ b/logout.php @@ -1,23 +1,24 @@ - + 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 diff --git a/passwords.php b/passwords.php new file mode 100644 index 0000000..14da475 --- /dev/null +++ b/passwords.php @@ -0,0 +1,42 @@ +'; -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..7eb2656 100644 --- a/recover_password.php +++ b/recover_password.php @@ -1,60 +1,35 @@ +


    -
    - -
    +
    +
    +
    +
    +
    + Recover password + + Student number +
    + Email +
    + +
    +
    +
    -
    - -

    Reset my password

    -
    + '; + $_SESSION['info_recover_password'] = null; + } + ?> -
    -
    - - Student number -
    - Email -
    - - -
    +
    -'; - $_SESSION['info_recover_password']=null; -} - -?> - - diff --git a/signup.php b/signup.php index ae17b5e..3e45d0c 100644 --- a/signup.php +++ b/signup.php @@ -1,64 +1,53 @@ - - - - -
    - -
    - -
    - -

    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; - } - ?> -
    - -
    -
    -
    -
    - \ No newline at end of file + + + + +


    + +
    + +
    + +
    + +
    + +
    + Sign up + + + + Full Name +
    + + Student ID +
    + + Email +
    + + Password +
    + + Confirm Password +
    +
    + + + '; + $_SESSION['info_signup'] = null; + } + ?> + +
    +
    +
    +
    +