From ae1772f8399e92f2404616ef8d6cd8b563964e73 Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Fri, 20 Jan 2023 17:32:33 +0800 Subject: [PATCH 1/2] USe info_ReMarking instead of Reflect. --- Script.php | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Script.php b/Script.php index 89b9829..5d7e3d9 100644 --- a/Script.php +++ b/Script.php @@ -195,7 +195,6 @@ if (!empty($_POST["frm_recover_password"])) { // validate student number if (strlen($student_id) != 12 || is_numeric($student_id) == FALSE) { $_SESSION["info_recover_password"] = "Invalid student number."; - #echo "Invalid student number."; header("Location: recover_password.php"); return; } @@ -693,7 +692,7 @@ if (!empty($_GET["remarking"])) { if ($con->query($sql) === TRUE) { - $_SESSION["Reflect"] = "Remarking Request Sent"; + $_SESSION["info_ReMarking"] = "Remarking Request Sent"; header("Location: Course.php?url=" . $url); } else { echo "Error: " . $sql . "
" . $con->error; @@ -722,7 +721,7 @@ if (!empty($_GET["creategroup"])) { $sql = "INSERT INTO `course_group_members_table`( `Course_Group_id`, `Student_ID`, `Status`) VALUES ('$gid','$student_id','Created')"; if ($con->query($sql) === TRUE) { - $_SESSION["Reflect"] = "Course group Created"; + $_SESSION["info_ReMarking"] = "Course group Created"; header("Location: Course.php?url=" . $url); } else { echo "Error: " . $sql . "
" . $con->error; @@ -740,21 +739,20 @@ if (!empty($_GET["groupinvite"])) { $url = mysqli_real_escape_string($con, $_GET["url"]); $courseid = mysqli_real_escape_string($con, $_GET["courseid"]); $groupid = mysqli_real_escape_string($con, $_GET["groupid"]); - $student = mysqli_query($con, "SELECT * FROM students_data WHERE Student_ID = '$student_id' "); if (mysqli_num_rows($student) > 0) { $result = mysqli_query($con, "SELECT * FROM course_group_members_table where Course_Group_id = '$groupid' and Student_ID = '$student_id'"); if (mysqli_num_rows($result) > 0) { - $_SESSION["Reflect"] = $student_id . " has already been invited"; + $_SESSION["info_ReMarking"] = $student_id . " has already been invited."; header("Location: Course.php?url=" . $url); } else { $sql = "INSERT INTO `course_group_members_table`( `Course_Group_id`, `Student_ID`, `Status`) VALUES ('$groupid','$student_id','Invited')"; } } else { - $_SESSION["Reflect"] = $student_id . " Invalid Student Number "; + $_SESSION["info_ReMarking"] = $student_id . " is an invalid student number."; header("Location: Course.php?url=" . $url); } @@ -773,26 +771,26 @@ if (!empty($_GET["groupinvite"])) { if ($Group_Member == '0') { mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'"); - $_SESSION["Reflect"] = $student_id . " was invited to the group"; + $_SESSION["info_ReMarking"] = $student_id . " was invited to the group."; header("Location: Course.php?url=" . $url); } elseif ($Group_Member2 == '0') { mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member2` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'"); - $_SESSION["Reflect"] = $student_id . " was invited to the group"; + $_SESSION["info_ReMarking"] = $student_id . " was invited to the group."; header("Location: Course.php?url=" . $url); } elseif ($Group_Member3 == '0') { mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member3` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'"); - $_SESSION["Reflect"] = $student_id . " was invited to the group"; + $_SESSION["info_ReMarking"] = $student_id . " was invited to the group."; header("Location: Course.php?url=" . $url); } elseif ($Group_Member4 == '0') { mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member4` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'"); - $_SESSION["Reflect"] = $student_id . " was invited to the group"; + $_SESSION["info_ReMarking"] = $student_id . " was invited to the group."; header("Location: Course.php?url=" . $url); } else { - $_SESSION["Reflect"] = " You cant add any more members"; + $_SESSION["info_ReMarking"] = " You cannot add any more members"; header("Location: Course.php?url=" . $url); } } - $_SESSION["Reflect"] = $student_id . " was invited to the group"; + $_SESSION["info_ReMarking"] = $student_id . " was invited to the group."; header("Location: Course.php?url=" . $url); } else { echo "Error: " . $sql . "
" . $con->error; @@ -817,7 +815,7 @@ if (!empty($_GET["acceptinvite"])) { } if ($con->query($sql) === TRUE) { - $_SESSION["Reflect"] = " Group Invite Updated"; + $_SESSION["info_ReMarking"] = " Group Invite Updated"; header("Location: Course.php?url=" . $url); } else { echo "Error: " . $sql . "
" . $con->error; -- 2.17.1 From d642f1e335841df6ca2ce76c37d18da95632a455 Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Fri, 20 Jan 2023 17:38:39 +0800 Subject: [PATCH 2/2] Use info_general instead of info_Remarking. --- Course.php | 6 +++--- Script.php | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Course.php b/Course.php index 34561e3..5dc8583 100644 --- a/Course.php +++ b/Course.php @@ -57,9 +57,9 @@ if(!empty($_GET["url"])) '; - $_SESSION['info_ReMarking']=null; +if (isset($_SESSION['info_general'])) { + echo '
'; + $_SESSION['info_general']=null; } if (isset($_SESSION['info_courses'])) { diff --git a/Script.php b/Script.php index 5d7e3d9..c0bfd7e 100644 --- a/Script.php +++ b/Script.php @@ -692,7 +692,7 @@ if (!empty($_GET["remarking"])) { if ($con->query($sql) === TRUE) { - $_SESSION["info_ReMarking"] = "Remarking Request Sent"; + $_SESSION["info_general"] = "Remarking Request Sent"; header("Location: Course.php?url=" . $url); } else { echo "Error: " . $sql . "
" . $con->error; @@ -721,7 +721,7 @@ if (!empty($_GET["creategroup"])) { $sql = "INSERT INTO `course_group_members_table`( `Course_Group_id`, `Student_ID`, `Status`) VALUES ('$gid','$student_id','Created')"; if ($con->query($sql) === TRUE) { - $_SESSION["info_ReMarking"] = "Course group Created"; + $_SESSION["info_general"] = "Course group Created"; header("Location: Course.php?url=" . $url); } else { echo "Error: " . $sql . "
" . $con->error; @@ -745,14 +745,14 @@ if (!empty($_GET["groupinvite"])) { $result = mysqli_query($con, "SELECT * FROM course_group_members_table where Course_Group_id = '$groupid' and Student_ID = '$student_id'"); if (mysqli_num_rows($result) > 0) { - $_SESSION["info_ReMarking"] = $student_id . " has already been invited."; + $_SESSION["info_general"] = $student_id . " has already been invited."; header("Location: Course.php?url=" . $url); } else { $sql = "INSERT INTO `course_group_members_table`( `Course_Group_id`, `Student_ID`, `Status`) VALUES ('$groupid','$student_id','Invited')"; } } else { - $_SESSION["info_ReMarking"] = $student_id . " is an invalid student number."; + $_SESSION["info_general"] = $student_id . " is an invalid student number."; header("Location: Course.php?url=" . $url); } @@ -771,26 +771,26 @@ if (!empty($_GET["groupinvite"])) { if ($Group_Member == '0') { mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'"); - $_SESSION["info_ReMarking"] = $student_id . " was invited to the group."; + $_SESSION["info_general"] = $student_id . " was invited to the group."; header("Location: Course.php?url=" . $url); } elseif ($Group_Member2 == '0') { mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member2` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'"); - $_SESSION["info_ReMarking"] = $student_id . " was invited to the group."; + $_SESSION["info_general"] = $student_id . " was invited to the group."; header("Location: Course.php?url=" . $url); } elseif ($Group_Member3 == '0') { mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member3` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'"); - $_SESSION["info_ReMarking"] = $student_id . " was invited to the group."; + $_SESSION["info_general"] = $student_id . " was invited to the group."; header("Location: Course.php?url=" . $url); } elseif ($Group_Member4 == '0') { mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member4` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'"); - $_SESSION["info_ReMarking"] = $student_id . " was invited to the group."; + $_SESSION["info_general"] = $student_id . " was invited to the group."; header("Location: Course.php?url=" . $url); } else { - $_SESSION["info_ReMarking"] = " You cannot add any more members"; + $_SESSION["info_general"] = " You cannot add any more members"; header("Location: Course.php?url=" . $url); } } - $_SESSION["info_ReMarking"] = $student_id . " was invited to the group."; + $_SESSION["info_general"] = $student_id . " was invited to the group."; header("Location: Course.php?url=" . $url); } else { echo "Error: " . $sql . "
" . $con->error; @@ -815,7 +815,7 @@ if (!empty($_GET["acceptinvite"])) { } if ($con->query($sql) === TRUE) { - $_SESSION["info_ReMarking"] = " Group Invite Updated"; + $_SESSION["info_general"] = " Group Invite Updated"; header("Location: Course.php?url=" . $url); } else { echo "Error: " . $sql . "
" . $con->error; @@ -833,7 +833,7 @@ if (!empty($_GET["removemember"])) { $sql = "Delete from `course_group_members_table` where student_id=$student_id and Course_Group_id=$group_id"; if ($con->query($sql) === TRUE) { - $_SESSION["info_ReMarking"] = " Member " . $student_id . " removed from the group"; + $_SESSION["info_general"] = " Member " . $student_id . " removed from the group"; header("Location: Course.php?url=" . $url); } else { echo "Error: " . $sql . "
" . $con->error; @@ -851,7 +851,7 @@ if (!empty($_GET["deletegroup"])) { $sql2 = "Delete from `course_groups_table` where Course_Group_id=$group_id"; if ($con->query($sql1) === TRUE && $con->query($sql2) === TRUE) { - $_SESSION["info_ReMarking"] = " Group has been deleted successfully. "; + $_SESSION["info_general"] = " Group has been deleted successfully. "; header("Location: Course.php?url=" . $url); } else { echo "Error: " . $sql . "
" . $con->error; -- 2.17.1