Compare commits
No commits in common. "master" and "Bug519-Hui" have entirely different histories.
master
...
Bug519-Hui
|
@ -57,9 +57,9 @@ if(!empty($_GET["url"]))
|
|||
|
||||
<?php
|
||||
|
||||
if (isset($_SESSION['info_general'])) {
|
||||
echo '<hr><div class="alert alert-info" role="alert" style="float:left;">' . $_SESSION['info_general'] . '</div>';
|
||||
$_SESSION['info_general']=null;
|
||||
if (isset($_SESSION['info_ReMarking'])) {
|
||||
echo '<hr><div class="alert alert-info" role="alert" style="float:left;">' . $_SESSION['info_ReMarking'] . '</div>';
|
||||
$_SESSION['info_ReMarking']=null;
|
||||
}
|
||||
|
||||
if (isset($_SESSION['info_courses'])) {
|
||||
|
|
14
README.md
14
README.md
|
@ -18,17 +18,15 @@ Our mission is to make the experience of submitting assignments great for tens o
|
|||
# Installation Instructions
|
||||
|
||||
|
||||
## Hui steps
|
||||
## Hui's steps
|
||||
|
||||
I spent about two hours installing LRR to a bare, remote Ubuntu server (Ubuntu 20.04 LTS).
|
||||
|
||||
LRR needs Apache and MySQL to run. I followed [How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 20.04](https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04) to set up these server applications. [How to install and configure PHP](https://ubuntu.com/server/docs/programming-php) is also a good guide.
|
||||
LRR needs Apache and MySQL to run. I followed [How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 20.04](https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04) to set up these server applications.
|
||||
|
||||
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.
|
||||
LRR uses a database called `lrr`. 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`.
|
||||
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.
|
||||
|
||||
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,7 +49,7 @@ 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/.
|
||||
|
||||
|
||||
## Enock steps
|
||||
## Enock's 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).
|
||||
|
||||
|
|
28
Script.php
28
Script.php
|
@ -195,6 +195,7 @@ 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;
|
||||
}
|
||||
|
@ -692,7 +693,7 @@ if (!empty($_GET["remarking"])) {
|
|||
|
||||
if ($con->query($sql) === TRUE) {
|
||||
|
||||
$_SESSION["info_general"] = "Remarking Request Sent";
|
||||
$_SESSION["Reflect"] = "Remarking Request Sent";
|
||||
header("Location: Course.php?url=" . $url);
|
||||
} else {
|
||||
echo "Error: " . $sql . "<br>" . $con->error;
|
||||
|
@ -721,7 +722,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_general"] = "Course group Created";
|
||||
$_SESSION["Reflect"] = "Course group Created";
|
||||
header("Location: Course.php?url=" . $url);
|
||||
} else {
|
||||
echo "Error: " . $sql . "<br>" . $con->error;
|
||||
|
@ -739,20 +740,21 @@ 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["info_general"] = $student_id . " has already been invited.";
|
||||
$_SESSION["Reflect"] = $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_general"] = $student_id . " is an invalid student number.";
|
||||
$_SESSION["Reflect"] = $student_id . " Invalid Student Number ";
|
||||
header("Location: Course.php?url=" . $url);
|
||||
}
|
||||
|
||||
|
@ -771,26 +773,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_general"] = $student_id . " was invited to the group.";
|
||||
$_SESSION["Reflect"] = $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_general"] = $student_id . " was invited to the group.";
|
||||
$_SESSION["Reflect"] = $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_general"] = $student_id . " was invited to the group.";
|
||||
$_SESSION["Reflect"] = $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_general"] = $student_id . " was invited to the group.";
|
||||
$_SESSION["Reflect"] = $student_id . " was invited to the group";
|
||||
header("Location: Course.php?url=" . $url);
|
||||
} else {
|
||||
$_SESSION["info_general"] = " You cannot add any more members";
|
||||
$_SESSION["Reflect"] = " You cant add any more members";
|
||||
header("Location: Course.php?url=" . $url);
|
||||
}
|
||||
}
|
||||
$_SESSION["info_general"] = $student_id . " was invited to the group.";
|
||||
$_SESSION["Reflect"] = $student_id . " was invited to the group";
|
||||
header("Location: Course.php?url=" . $url);
|
||||
} else {
|
||||
echo "Error: " . $sql . "<br>" . $con->error;
|
||||
|
@ -815,7 +817,7 @@ if (!empty($_GET["acceptinvite"])) {
|
|||
}
|
||||
|
||||
if ($con->query($sql) === TRUE) {
|
||||
$_SESSION["info_general"] = " Group Invite Updated";
|
||||
$_SESSION["Reflect"] = " Group Invite Updated";
|
||||
header("Location: Course.php?url=" . $url);
|
||||
} else {
|
||||
echo "Error: " . $sql . "<br>" . $con->error;
|
||||
|
@ -833,7 +835,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_ReMarking"] = " Member " . $student_id . " removed from the group";
|
||||
header("Location: Course.php?url=" . $url);
|
||||
} else {
|
||||
echo "Error: " . $sql . "<br>" . $con->error;
|
||||
|
@ -851,7 +853,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_general"] = " Group has been deleted successfully. ";
|
||||
$_SESSION["info_ReMarking"] = " Group has been deleted successfully. ";
|
||||
header("Location: Course.php?url=" . $url);
|
||||
} else {
|
||||
echo "Error: " . $sql . "<br>" . $con->error;
|
||||
|
|
Loading…
Reference in New Issue