Merge branch 'master' into lrr-enockkays/Samantha

SIMPLICITY_Bug-189_Course_Delete_btn
enockkays 2020-12-23 16:46:51 +08:00 committed by GitHub
commit 511ff80ee1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 30 additions and 69 deletions

View File

@ -3,7 +3,8 @@ session_start();
error_reporting(0); error_reporting(0);
date_default_timezone_set('Asia/Shanghai'); 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 // Check database connection
if (mysqli_connect_errno()) { if (mysqli_connect_errno()) {

View File

@ -134,6 +134,10 @@ The original GitHub Repo is at https://github.com/EngMohamedNor/LabReportRepo
(Please put your name and student number below.) (Please put your name and student number below.)
CODEwithZAKI - Omar Mohamud Mohamed - 202025800041
BloudYoussef - Khayat Youssef - 202025800042
TanakaMichelle - Tanaka Michelle Sandati - 201732120134 TanakaMichelle - Tanaka Michelle Sandati - 201732120134
WhyteAsamoah - Yeboah Martha Asamoah - 201732120135 WhyteAsamoah - Yeboah Martha Asamoah - 201732120135

View File

@ -12,7 +12,8 @@ session_start();
date_default_timezone_set('Asia/Shanghai'); date_default_timezone_set('Asia/Shanghai');
// Connect to MySQL database // 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 // Check connection
if (mysqli_connect_errno()) if (mysqli_connect_errno())
@ -527,7 +528,7 @@ function checksize($file)
{ {
$result = $_FILES["$file"]['size']/(1024*1024); $result = $_FILES["$file"]['size']/(1024*1024);
if($result > 1) if($result > 3)
{ {
return FALSE; return FALSE;
} }

View File

@ -495,7 +495,7 @@ include 'Footer.php';
buttons: { buttons: {
'Submit Marking': function () { 'Submit Marking': function () {
$('#submit-form').submit(); $('#submit-form').submit();
//$('input[type=submit].default').submit();
$(this).dialog('close'); $(this).dialog('close');
}, },
'X': function () { 'X': function () {
@ -520,7 +520,7 @@ function updatev(id)
{ {
$('<form id="frm" method="get" action="Script.php"> <input type="hidden" name="updatevisibility" value="true">\n\ $('<form id="submit-form" method="get" action="Script.php"> <input type="hidden" name="updatevisibility" value="true">\n\
<input type="hidden" name="id" value="'+id+'" > <br>\n\ <input type="hidden" name="id" value="'+id+'" > <br>\n\
Update Visibility<br><select name="status"> <option> Public </option><option>Private</option> </select> \n\ Update Visibility<br><select name="status"> <option> Public </option><option>Private</option> </select> \n\
<input type="hidden" name="labid" value="<?php echo $id; ?>"> <input type="hidden" name="total" value="<?php echo $total; ?>" > <input type="hidden" name="header" value="<?php echo $header; ?>"> </form>').dialog({ <input type="hidden" name="labid" value="<?php echo $id; ?>"> <input type="hidden" name="total" value="<?php echo $total; ?>" > <input type="hidden" name="header" value="<?php echo $header; ?>"> </form>').dialog({
@ -528,7 +528,10 @@ Update Visibility<br><select name="status"> <option> Public </option><option>Pri
title:'Update Report Visibility', title:'Update Report Visibility',
buttons: { buttons: {
'Update': function () { 'Update': function () {
$('#submit-form').submit() $('#submit-form').submit()
$('#submit-form').submit();
$(this).dialog('close'); $(this).dialog('close');
}, },

View File

@ -2,9 +2,12 @@
// Code contributed by Xu Xiaopeng and his team (https://github.com/lanlab-org/LRR/pull/39/files#diff-b69ba96bf0e469383b373e8c9de257c0) // 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"; $servername = "localhost";
$username = "username"; $username = $mysql_username;
$password = "password"; $password = $mysql_password;
$dbname = "lrr"; $dbname = "lrr";
// 创建连接 // 创建连接
@ -52,4 +55,4 @@ $result->free();
//中断连接 //中断连接
mysqli_close($conn); mysqli_close($conn);
?> ?>

View File

@ -0,0 +1,5 @@
<?php
$csv = array_map('str_getcsv', file('./../../lrr_submission/KeepItSafe.txt'));
$mysql_username = $csv[0][0];
$mysql_password = $csv[0][1];
?>

View File

@ -405,6 +405,11 @@ ALTER TABLE `lab_report_submissions`
ALTER TABLE `students_data` ALTER TABLE `students_data`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; 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);
-- --
-- AUTO_INCREMENT for table `users_table` -- AUTO_INCREMENT for table `users_table`
-- --

View File

@ -1,61 +0,0 @@
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'on');
echo phpversion();
$hashed_password1 = hash('sha512', '123a');
$hashed_password2 = hash('sha512', '123a');
echo "Hash1=".$hashed_password1;
echo "<hr>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 "<table>";
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<br>"; }
//echo "<tr>";
//echo "<td>{$row['Password']}</td><td>{$row['Email']}</td>";
//echo "</tr>";
}
echo "</table>";
}