From 09e857bbf6b029588a824fc0192e770ff94c4e43 Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Fri, 2 Oct 2020 23:02:27 +0800 Subject: [PATCH 1/8] A better way to store mysql credentials. --- Header.php | 3 +- Script.php | 3 +- batch_insert.php | 9 ++++-- get_mysql_credentials.php | 5 ++++ test.php | 61 --------------------------------------- 5 files changed, 15 insertions(+), 66 deletions(-) create mode 100644 get_mysql_credentials.php delete mode 100644 test.php diff --git a/Header.php b/Header.php index e867e1e..a5787c3 100644 --- a/Header.php +++ b/Header.php @@ -3,7 +3,8 @@ session_start(); error_reporting(0); date_default_timezone_set('Asia/Shanghai'); -$con = mysqli_connect("localhost","username","password","lrr"); +include "get_mysql_credentials.php"; +$con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr"); // Check database connection if (mysqli_connect_errno()) { diff --git a/Script.php b/Script.php index b0225ea..cc9fa3b 100644 --- a/Script.php +++ b/Script.php @@ -12,7 +12,8 @@ session_start(); date_default_timezone_set('Asia/Shanghai'); // Connect to MySQL database -$con = mysqli_connect("localhost","username","password","lrr"); +include "get_mysql_credentials.php"; +$con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr"); // Check connection if (mysqli_connect_errno()) diff --git a/batch_insert.php b/batch_insert.php index 664bf66..00dad1b 100644 --- a/batch_insert.php +++ b/batch_insert.php @@ -2,9 +2,12 @@ // Code contributed by Xu Xiaopeng and his team (https://github.com/lanlab-org/LRR/pull/39/files#diff-b69ba96bf0e469383b373e8c9de257c0) //数据库信息 + + +include "get_mysql_credentials.php"; $servername = "localhost"; -$username = "username"; -$password = "password"; +$username = $mysql_username; +$password = $mysql_password; $dbname = "lrr"; // 创建连接 @@ -52,4 +55,4 @@ $result->free(); //中断连接 mysqli_close($conn); -?> \ No newline at end of file +?> diff --git a/get_mysql_credentials.php b/get_mysql_credentials.php new file mode 100644 index 0000000..c520376 --- /dev/null +++ b/get_mysql_credentials.php @@ -0,0 +1,5 @@ + diff --git a/test.php b/test.php deleted file mode 100644 index 4780387..0000000 --- a/test.php +++ /dev/null @@ -1,61 +0,0 @@ -Hash2=".$hashed_password2; - - - - -$con=mysqli_connect("localhost","username","password","lrr"); -// Check connection -if (mysqli_connect_errno()) - { - echo "Failed to connect to MySQL: " . mysqli_connect_error(); - } -else -{ -echo "Connected "; -} - -mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); -$query = "SELECT * from users_table;"; -$result = mysqli_query($con, $query); - - -if (mysqli_num_rows($result) > 0) { - - echo ""; - - while ($row = mysqli_fetch_assoc($result)) { - -$id=$row["User_ID"]; -$pass=$row["Password"]; -$hash_pass=hash('sha512', $pass); -$inner_query = "update users_table set HashPassword='$hash_pass' where User_ID=$id;"; -if ($con->query($inner_query) === TRUE) { echo " User # $id updated
"; } - - //echo ""; - //echo ""; - //echo ""; - - } - - echo "
{$row['Password']}{$row['Email']}
"; - - -} - - From d4cb07ba1ce5c6bb2f8bc7cd3c1703225c8c0f32 Mon Sep 17 00:00:00 2001 From: CODEwithZAKI Date: Tue, 15 Dec 2020 05:30:00 +0300 Subject: [PATCH 2/8] increased the size of column_name Course_Name --- README.md | 4 ++++ lrr (1).sql | 2 ++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index ece6575..fac0a53 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,10 @@ The original GitHub Repo is at https://github.com/EngMohamedNor/LabReportRepo (Please put your name and student number below.) +CODEwithZAKI - Omar Mohamud Mohamed - 202025800041 + +BloudYoussef - Khayat Youssef - 202025800042 + TanakaMichelle - Tanaka Michelle Sandati - 201732120134 WhyteAsamoah - Yeboah Martha Asamoah - 201732120135 diff --git a/lrr (1).sql b/lrr (1).sql index 62280ae..9a88436 100644 --- a/lrr (1).sql +++ b/lrr (1).sql @@ -405,6 +405,8 @@ ALTER TABLE `lab_report_submissions` ALTER TABLE `students_data` MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; + ALTER TABLE 'courses_table' + MODIFY 'Course_Name' varchar(500); -- -- AUTO_INCREMENT for table `users_table` -- From 2567a7fe21d28f638795c3df80258bbe048dc53f Mon Sep 17 00:00:00 2001 From: CODEwithZAKI Date: Tue, 15 Dec 2020 05:56:04 +0300 Subject: [PATCH 3/8] Fixed Bug 25 --- lrr (1).sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lrr (1).sql b/lrr (1).sql index 9a88436..10a6809 100644 --- a/lrr (1).sql +++ b/lrr (1).sql @@ -405,6 +405,9 @@ ALTER TABLE `lab_report_submissions` ALTER TABLE `students_data` MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; + -- + -- updading size of Course_Name` + -- ALTER TABLE 'courses_table' MODIFY 'Course_Name' varchar(500); -- From 2778a9ed3b4d5f08076fc9b51398f6de31ce49c2 Mon Sep 17 00:00:00 2001 From: CODEwithZAKI Date: Tue, 15 Dec 2020 06:20:24 +0300 Subject: [PATCH 4/8] Removed leading space --- lrr (1).sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lrr (1).sql b/lrr (1).sql index 10a6809..d6892d0 100644 --- a/lrr (1).sql +++ b/lrr (1).sql @@ -405,11 +405,11 @@ ALTER TABLE `lab_report_submissions` ALTER TABLE `students_data` MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; - -- - -- updading size of Course_Name` - -- - ALTER TABLE 'courses_table' - MODIFY 'Course_Name' varchar(500); +-- +-- updading size of Course_Name` +-- +ALTER TABLE 'courses_table' +MODIFY 'Course_Name' varchar(500); -- -- AUTO_INCREMENT for table `users_table` -- From 69355029a8f2d059e8f981e2ceee3baafa17a38b Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Tue, 22 Dec 2020 17:42:29 +0800 Subject: [PATCH 5/8] Script.php: increase attachment size to 3MB. --- Script.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Script.php b/Script.php index cc9fa3b..b00e8d5 100644 --- a/Script.php +++ b/Script.php @@ -528,7 +528,7 @@ function checksize($file) { $result = $_FILES["$file"]['size']/(1024*1024); - if($result > 1) + if($result > 3) { return FALSE; } From 08e19558070020606d824487b6cd8bfac0108361 Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Tue, 22 Dec 2020 18:22:35 +0800 Subject: [PATCH 6/8] Submissions.php: fix bug# 177: Mark submission does not work (http://118.25.96.118/bugzilla/show_bug.cgi?id=177). --- Submissions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Submissions.php b/Submissions.php index 411fe75..2f6696e 100644 --- a/Submissions.php +++ b/Submissions.php @@ -486,7 +486,7 @@ include 'Footer.php'; { - $('
'+title+'('+marks+' marks) \n\ + $(''+title+'('+marks+' marks) \n\
Marks \n\ Comments \n\
').dialog({ @@ -494,7 +494,7 @@ include 'Footer.php'; title:'Mark Submission', buttons: { 'Submit Marking': function () { - $('#frm').submit(); + $('#submit-form').submit(); $(this).dialog('close'); }, @@ -520,7 +520,7 @@ function updatev(id) { - $('
\n\ + $(' \n\
\n\ Update Visibility
\n\
').dialog({ @@ -528,7 +528,7 @@ Update Visibility