From e64af95eee25c71fdd5e2120c45a18cee047d037 Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:03:36 +0800 Subject: [PATCH 01/16] Admin.php: format code using visual studio code's PHP Intelephense. --- .vscode/extensions.json | 5 + Admin.php | 602 ++++++++++----------- Course.php | 1117 +++++++++++++++++++-------------------- 3 files changed, 823 insertions(+), 901 deletions(-) create mode 100644 .vscode/extensions.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..5570731 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "thamaraiselvam.remove-blank-lines" + ] +} \ No newline at end of file diff --git a/Admin.php b/Admin.php index fcbe519..0c8b4ca 100644 --- a/Admin.php +++ b/Admin.php @@ -1,367 +1,323 @@ <?php - include 'NoDirectPhpAcess.php'; +include 'NoDirectPhpAcess.php'; ?> - <?php -$page="admin"; +$page = "admin"; include 'Header.php'; ?> <?php if ($_SESSION['user_type'] != "Lecturer") { - $_SESSION["info_login"]="You must log in first."; - echo $_SESSION["info_login"]; - header("Location: index.php"); + $_SESSION["info_login"] = "You must log in first."; + echo $_SESSION["info_login"]; + header("Location: index.php"); } ?> <style> - .col-md-4{ - border-right: 1px solid skyblue; - } + .col-md-4 { + border-right: 1px solid skyblue; + } </style> <br> -<div style="width: 80%;margin: auto;"> <h2> Administration Panel </h2> </div> - - <hr> +<div style="width: 80%;margin: auto;"> + <h2> Administration Panel </h2> +</div> + +<hr> <div class="row" style="width: 80%;margin: auto;"> - - - - <!--<h4>General system Settings</h4><hr> + + <!--<h4>General system Settings</h4><hr> <a href="" class="btn btn-lg btn-primary">View System Log </a> <hr> Lab Privacy Mode: (STUDENT VERIFICATION) <hr> --> - <div class="col-md-6"> - <h4> User Account Management </h4><hr> - - <b>Lecturer / TA Accounts </b><br> - - - - - - - <div class="container"> + <div class="col-md-6"> + <h4> User Account Management </h4> + <hr> + <b>Lecturer / TA Accounts </b><br> + <div class="container"> - <!-- Nav tabs --> - <ul class="nav nav-tabs" role="tablist"> + <!-- Nav tabs --> + <ul class="nav nav-tabs" role="tablist"> - <li class="nav-item"> - <a class="nav-link active" data-toggle="tab" href="#home">Create New Account</a> - </li> + <li class="nav-item"> + <a class="nav-link active" data-toggle="tab" href="#home">Create New Account</a> + </li> - <li class="nav-item"> - <a class="nav-link" data-toggle="tab" href="#menu2">Batch Create New Student Accounts</a> - </li> + <li class="nav-item"> + <a class="nav-link" data-toggle="tab" href="#menu2">Batch Create New Student Accounts</a> + </li> - <li class="nav-item"> - <a class="nav-link" data-toggle="tab" href="#menu1">Existing Accounts</a> - </li> - - </ul> + <li class="nav-item"> + <a class="nav-link" data-toggle="tab" href="#menu1">Existing Accounts</a> + </li> - <!-- Tab panes --> - <div class="tab-content"> + </ul> - <div id="home" class="container tab-pane active"><br> - - <b>Create Lecturer/TA Accounts </b> - <form method="post" action="Script.php"> - <input type="hidden" name="frm_createlecturrer" value="true" required=""/> - Full_Name -<input type="text" name="fullname" placeholder="Full Name" class="form-control" required=""> -Email -<input type="text" name="email" placeholder="Email / Student Number" class="form-control" required=""> - - Passport_Number / ID (Used as Intial Password) -<input type="text" class="form-control" name="passport" placeholder="Passport No./ID" required=""> - <br> User Type : - <input type="radio" name="type" value="Lecturer" required=""> Lecturer - <input type="radio" name="type" value="TA" required=""> T/A - <input type="submit" class="btn btn-primary" value="Create"><br> -<?php + <!-- Tab panes --> + <div class="tab-content"> -error_reporting(E_ALL); -if(isset($_SESSION['info_Admin_Users'])) { - echo '<hr><div class="alert alert-info" role="alert">'.$_SESSION['info_Admin_Users'].'</div>'; - $_SESSION['info_Admin_Users']=null; -} -if(isset($_SESSION['info_Admin_Users'])) { - echo '<hr><div class="alert alert-info" role="alert">'.$_SESSION['info_Admin_Users'].'</div>'; - $_SESSION['info_Admin_Users']=null; -} + <div id="home" class="container tab-pane active"><br> -?> + <b>Create Lecturer/TA Accounts </b> + <form method="post" action="Script.php"> + <input type="hidden" name="frm_createlecturrer" value="true" required="" /> + Full_Name + <input type="text" name="fullname" placeholder="Full Name" class="form-control" required=""> + Email + <input type="text" name="email" placeholder="Email / Student Number" class="form-control" required=""> - </form> - -<hr> + Passport_Number / ID (Used as Intial Password) + <input type="text" class="form-control" name="passport" placeholder="Passport No./ID" required=""> + <br> User Type : + <input type="radio" name="type" value="Lecturer" required=""> Lecturer + <input type="radio" name="type" value="TA" required=""> T/A + <input type="submit" class="btn btn-primary" value="Create"><br> + <?php + error_reporting(E_ALL); + if (isset($_SESSION['info_Admin_Users'])) { + echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Users'] . '</div>'; + $_SESSION['info_Admin_Users'] = null; + } + if (isset($_SESSION['info_Admin_Users'])) { + echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Users'] . '</div>'; + $_SESSION['info_Admin_Users'] = null; + } + ?> - </div> - - - <div id="menu1" class="container tab-pane fade"><br> - -<table class="table-bordered" style="font-size: 10pt;"> - <tr style="font-size:10pt;"> - <th>ID</th> - <th>Name</th> - <th>Email</th> - <th>Passport / ID </th> - <th>Reset Password </th> - <th>Block/Activate </th> - </tr> -<?php + </form> - $result = mysqli_query($con, - "SELECT * FROM Users_Table WHERE UserType in ('Lecturer','TA')"); - while($row = mysqli_fetch_assoc($result)) { - $pass=$row['Passport_Number']; - $btn="<button class='btn-primary' onclick=\"updatePass(".$row['User_ID'].",'$pass')\">Reset</button>"; - if($row['Status']=="Active") - { $newstatus="Blocked"; - $btnBlock="<button class='btn-danger' onclick=\"blockUser(".$row['User_ID'].",'$newstatus')\">Block</button>"; - }else{ - $newstatus="Active"; - $btnBlock="<button class='btn-success' onclick=\"blockUser(".$row['User_ID'].",'$newstatus')\">Activate</button>"; - } - - echo "<tr><td>".$row['User_ID']."</td><td>".$row['Full_Name']."</td><td>".$row['Email']."</td> <td>".$row['Passport_Number']."</td><td>$btn</td><td>$btnBlock</td></tr>"; - } -?></table> - - - </div> - + <hr> - <!-- code contributed by Xu Xiaopeng (https://github.com/xxp1999) --> - - <div id="menu2" class="container tab-pane fade" style="margin-top:10px" > - <b>Separate two student numbers with a space.</b><br> - <form action="batch_insert.php" method="post"> - <p> - <textarea cols="80" rows="16" name="users" required=""></textarea> - </p> - <input type="submit" class="btn btn-primary" value="Register Students"><br> - </form> - </div> - - - </div> -</div> - - - </div> - - <div class="col-md-6"> - - - - <div class="container"> - <!-- Nav tabs --> - <ul class="nav nav-tabs" role="tablist"> - <li class="nav-item"> - <a class="nav-link active" data-toggle="tab" href="#menua"> Course Portal </a> - </li> - <li class="nav-item"> - <a class="nav-link" data-toggle="tab" href="#menub">Existing Courses</a> - </li> - - </ul> - - <!-- Tab panes --> - <div class="tab-content"> - <div id="menua" class="container tab-pane active"><br> - - - - - - <hr> - <b>Create new Portal </b> - - - - <form method="post" action="Script.php"> - <input type="hidden" name="frm_createCourse" value="true" required=""/> - Course Name -<input type="text" name="name" placeholder="Course Name" class="form-control" required=""> - - Course Code -<input type="text" name="code" placeholder="Course Code" class="form-control" required=""> - -URL (Leave blank to use Course Name) -<input type="text" name="url" placeholder="Choose Custom URL " class="form-control" required=""> - -Academic Year -<input type="text" name="academic" placeholder="Academic Year" class="form-control" required=""> - - Faculty <br> -<input type="text" name="faculty" placeholder="Faculty" class="form-control" required=""> - - Assign Lecturer -<br> - -<select name="lecturer" class="form-control"> - <?php - $result = mysqli_query($con,"SELECT * FROM Users_Table WHERE UserType='Lecturer'"); - if(mysqli_num_rows($result)==0) - {} else { while($row = mysqli_fetch_assoc($result)) { - $id=$row['User_ID']; - $name=$row['Full_Name']; - echo "<option value='$id'> $name </option>"; - }}?> - -</select> - - - - - - - - - - -Assigned T/A <br> - <select name="ta" class="form-control"> - <?php - $result = mysqli_query($con,"SELECT * FROM Users_Table WHERE UserType='TA'"); - if(mysqli_num_rows($result)==0) - {} else { while($row = mysqli_fetch_assoc($result)) { - $id=$row['User_ID']; - $name=$row['Full_Name']; - echo "<option value='$id'> $name </option>"; - }}?> - -</select> - -Verify Joining Students -<input type="radio" name="verify" value="1"> Yes -<input type="radio" name="verify" value="0" checked=""> No - - <br> - <input type="submit" class="btn btn-primary" value="Create Portal"><br> - - </form> - - - - <?php - -error_reporting(E_ALL); -if(isset($_SESSION['info_Admin_Courses'])) { - echo '<hr><div class="alert alert-info" role="alert">'.$_SESSION['info_Admin_Courses'].'</div>'; - $_SESSION['info_Admin_Courses']=null; -} -if(isset($_SESSION['info_Admin_Courses'])) { - echo '<hr><div class="alert alert-info" role="alert">'.$_SESSION['info_Admin_Courses'].'</div>'; - $_SESSION['info_Admin_Courses']=null; -} - -?> - - - - - - </div> - - - <div id="menub" class="container tab-pane fade"><br> - - - - <b> Existing Course Portals </b> - <hr> - <table class="table-bordered" style="font-size: 10pt;"> - <tr> <th>Course Name </th> <th> Faculty </th> <th>Lecturer </th> <th>TAs</th> <th>Assign new TA </th> </tr> - <?php - $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)) { - $name=$row['Course_Name']; - $code=$row['Course_Code']; - $faculty=$row['Faculty']; - $lecturer=$row['Full_Name']; - $academic=$row['Academic_Year']; - $c_id=$row['Course_ID']; - - - - $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=$c_id"); - - $ta=""; - while($rowTA = mysqli_fetch_assoc($resultTA)) { - $ta=$ta." - ".$rowTA['TA_NAME']; - } - - - - - - echo" - <tr> <td>$code - $name</td> <td>$faculty </td> <td>$lecturer</td><td>$ta</td> <td><form method='get' action='Script.php'> <select name='ta' class=''>"; - - - - $resultx = mysqli_query($con,"SELECT * FROM Users_Table WHERE UserType='TA'"); - if(mysqli_num_rows($resultx)==0) - {} else { while($row = mysqli_fetch_assoc($resultx)) { - $id=$row['User_ID']; - $name=$row['Full_Name']; - echo "<option value='$id'> $name </option>"; - }} - - -echo "</select> <input type='hidden' name='assignTA' value='true'> <input type='hidden' name='id' value='$c_id'> <input type='submit' value='assign'></form> </td></tr> - "; - - - - }}?> - - </table> - </div> - + + <div id="menu1" class="container tab-pane fade"><br> + + <table class="table-bordered" style="font-size: 10pt;"> + <tr style="font-size:10pt;"> + <th>ID</th> + <th>Name</th> + <th>Email</th> + <th>Passport / ID </th> + <th>Reset Password </th> + <th>Block/Activate </th> + </tr> + <?php + + $result = mysqli_query( + $con, + "SELECT * FROM Users_Table WHERE UserType in ('Lecturer','TA')" + ); + while ($row = mysqli_fetch_assoc($result)) { + $pass = $row['Passport_Number']; + $btn = "<button class='btn-primary' onclick=\"updatePass(" . $row['User_ID'] . ",'$pass')\">Reset</button>"; + if ($row['Status'] == "Active") { + $newstatus = "Blocked"; + $btnBlock = "<button class='btn-danger' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\">Block</button>"; + } else { + $newstatus = "Active"; + $btnBlock = "<button class='btn-success' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\">Activate</button>"; + } + + echo "<tr><td>" . $row['User_ID'] . "</td><td>" . $row['Full_Name'] . "</td><td>" . $row['Email'] . "</td> <td>" . $row['Passport_Number'] . "</td><td>$btn</td><td>$btnBlock</td></tr>"; + } + ?> + </table> + + </div> + + <!-- code contributed by Xu Xiaopeng (https://github.com/xxp1999) --> + + <div id="menu2" class="container tab-pane fade" style="margin-top:10px"> + <b>Separate two student numbers with a space.</b><br> + <form action="batch_insert.php" method="post"> + <p> + <textarea cols="80" rows="16" name="users" required=""></textarea> + </p> + <input type="submit" class="btn btn-primary" value="Register Students"><br> + </form> + </div> + + </div> </div> - - -</div> - - - - - + + </div> + + <div class="col-md-6"> + + <div class="container"> + <!-- Nav tabs --> + <ul class="nav nav-tabs" role="tablist"> + <li class="nav-item"> + <a class="nav-link active" data-toggle="tab" href="#menua"> Course Portal </a> + </li> + <li class="nav-item"> + <a class="nav-link" data-toggle="tab" href="#menub">Existing Courses</a> + </li> + + </ul> + + <!-- Tab panes --> + <div class="tab-content"> + <div id="menua" class="container tab-pane active"><br> + + <hr> + <b>Create new Portal </b> + + <form method="post" action="Script.php"> + <input type="hidden" name="frm_createCourse" value="true" required="" /> + Course Name + <input type="text" name="name" placeholder="Course Name" class="form-control" required=""> + + Course Code + <input type="text" name="code" placeholder="Course Code" class="form-control" required=""> + + URL (Leave blank to use Course Name) + <input type="text" name="url" placeholder="Choose Custom URL " class="form-control" required=""> + + Academic Year + <input type="text" name="academic" placeholder="Academic Year" class="form-control" required=""> + + Faculty <br> + <input type="text" name="faculty" placeholder="Faculty" class="form-control" required=""> + + Assign Lecturer + <br> + + <select name="lecturer" class="form-control"> + <?php + $result = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='Lecturer'"); + if (mysqli_num_rows($result) == 0) { + } else { + while ($row = mysqli_fetch_assoc($result)) { + $id = $row['User_ID']; + $name = $row['Full_Name']; + echo "<option value='$id'> $name </option>"; + } + } ?> + + </select> + + Assigned T/A <br> + <select name="ta" class="form-control"> + <?php + $result = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='TA'"); + if (mysqli_num_rows($result) == 0) { + } else { + while ($row = mysqli_fetch_assoc($result)) { + $id = $row['User_ID']; + $name = $row['Full_Name']; + echo "<option value='$id'> $name </option>"; + } + } ?> + + </select> + + Verify Joining Students + <input type="radio" name="verify" value="1"> Yes + <input type="radio" name="verify" value="0" checked=""> No + + <br> + <input type="submit" class="btn btn-primary" value="Create Portal"><br> + + </form> + + <?php + + error_reporting(E_ALL); + if (isset($_SESSION['info_Admin_Courses'])) { + echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Courses'] . '</div>'; + $_SESSION['info_Admin_Courses'] = null; + } + if (isset($_SESSION['info_Admin_Courses'])) { + echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Courses'] . '</div>'; + $_SESSION['info_Admin_Courses'] = null; + } + + ?> + + </div> + + <div id="menub" class="container tab-pane fade"><br> + + <b> Existing Course Portals </b> + <hr> + <table class="table-bordered" style="font-size: 10pt;"> + <tr> + <th>Course Name </th> + <th> Faculty </th> + <th>Lecturer </th> + <th>TAs</th> + <th>Assign new TA </th> + </tr> + <?php + $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)) { + $name = $row['Course_Name']; + $code = $row['Course_Code']; + $faculty = $row['Faculty']; + $lecturer = $row['Full_Name']; + $academic = $row['Academic_Year']; + $c_id = $row['Course_ID']; + + $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=$c_id"); + + $ta = ""; + while ($rowTA = mysqli_fetch_assoc($resultTA)) { + $ta = $ta . " - " . $rowTA['TA_NAME']; + } + + echo " + <tr> <td>$code - $name</td> <td>$faculty </td> <td>$lecturer</td><td>$ta</td> <td><form method='get' action='Script.php'> <select name='ta' class=''>"; + + $resultx = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='TA'"); + if (mysqli_num_rows($resultx) == 0) { + } else { + while ($row = mysqli_fetch_assoc($resultx)) { + $id = $row['User_ID']; + $name = $row['Full_Name']; + echo "<option value='$id'> $name </option>"; + } + } + + echo "</select> <input type='hidden' name='assignTA' value='true'> <input type='hidden' name='id' value='$c_id'> <input type='submit' value='assign'></form> </td></tr> + "; + } + } ?> + + </table> + + </div> + + </div> + + </div> + <script> - function updatePass(id,pass) - { - if(!confirm('Are you to Reset User Password')) - { - return; + function updatePass(id, pass) { + if (!confirm('Are you to Reset User Password')) { + return; + } + + window.location.href = "\Script.php\?action=passchange&uid=" + id + "&pass=" + pass; } - window.location.href="\Script.php\?action=passchange&uid="+id+"&pass="+pass; - } - - function blockUser(id,status) - { - if(!confirm('Are you to change User Status')) - { - return; + function blockUser(id, status) { + if (!confirm('Are you to change User Status')) { + return; + } + window.location.href = "\Script.php\?action=statuschange&uid=" + id + "&status=" + status; } - window.location.href="\Script.php\?action=statuschange&uid="+id+"&status="+status; - } - </script> + </script> \ No newline at end of file diff --git a/Course.php b/Course.php index d7683ef..0dc6dbc 100644 --- a/Course.php +++ b/Course.php @@ -4,30 +4,28 @@ include 'NoDirectPhpAcess.php'; <?php -$page='Courses+'; +$page = 'Courses+'; include 'Header.php'; $student_id = $_SESSION["user_student_id"]; $group_id = $_SESSION["user_group_id"]; $c_date = date("Y-m-d H:i"); -if(!empty($_GET["url"])) -{ +if (!empty($_GET["url"])) { $course_url = $_GET["url"]; - $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 URL='$course_url' "); - - if(mysqli_num_rows($result)==0) { + $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 URL='$course_url' "); - echo "No course matching the given course URL: ".$course_url; + if (mysqli_num_rows($result) == 0) { + echo "No course matching the given course URL: " . $course_url; } else { - while($row = mysqli_fetch_assoc($result)) { - $name = $row['Course_Name']; + while ($row = mysqli_fetch_assoc($result)) { + $name = $row['Course_Name']; $code = $row['Course_Code']; - $faculty = $row['Faculty']; + $faculty = $row['Faculty']; $lecturer = $row['Full_Name']; $academic = $row['Academic_Year']; $url = $row['URL']; @@ -37,16 +35,16 @@ if(!empty($_GET["url"])) if (mysqli_num_rows($ta_result) == 0) { echo " <div class='alert' style='margin-left:20px;border-bottom:2px solid #1D91EF;'> <a href='~\..\Courses.php?course=$url'> Courses > $name ($code) > Lab Reports <br> <span style='font-size:8pt'>Faculty: $faculty | Year: $academic | Lecturer: $lecturer </span> - </a></div> "; + </a></div> "; } else { $ta_name = ""; while ($row = mysqli_fetch_assoc($ta_result)) { - $ta_name = $ta_name.$row['Full_Name']." "; + $ta_name = $ta_name . $row['Full_Name'] . " "; } - $ta_name = trim ($ta_name); + $ta_name = trim($ta_name); echo " <div class='alert' style='margin-left:20px;border-bottom:2px solid #1D91EF;'> <a href='~\..\Courses.php?course=$url'> Courses > $name ($code) > Lab Reports <br> <span style='font-size:8pt'>Faculty: $faculty | Year: $academic | Lecturer: $lecturer | Teaching Assistant: $ta_name </span> - </a></div> "; + </a></div> "; } } } @@ -54,79 +52,79 @@ if(!empty($_GET["url"])) ?> <div class="row" style='margin-left:20px;float:left'> - -<?php - -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'])) { - echo '<hr><div class="alert alert-info" role="alert" style="float:left;">' . $_SESSION['info_courses'] . '</div>'; - $_SESSION['info_courses']=null; -} -?> - + + <?php + + 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'])) { + echo '<hr><div class="alert alert-info" role="alert" style="float:left;">' . $_SESSION['info_courses'] . '</div>'; + $_SESSION['info_courses'] = null; + } + ?> + </div> <?php -if( $_SESSION['user_type'] == "Student") -{ - - ?> +if ($_SESSION['user_type'] == "Student") { + +?> <hr> <div class="row" style="width:95%;margin:auto; text-align:left;"> - <div class="col-md-9"> - - <!-- Nav tabs --> + <div class="col-md-9"> - <ul class="nav nav-tabs" role="tablist"> - <li class="nav-item"> - <a class="nav-link active" data-toggle="tab" href="#menu1">New</a> - </li> - <li class="nav-item"> - <a class="nav-link" data-toggle="tab" href="#menu2">Missed</a> - </li> - <li class="nav-item"> - <a class="nav-link" data-toggle="tab" href="#menu3">Submitted</a> - </li> - <li class="nav-item"> - <a class="nav-link" data-toggle="tab" href="#menu4">Marked</a> - </li> - - <!----------Delete Course Button-----------> - <li> -<html> -<body> - -<div class="modal fade" id="delcourse"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <h2 class="modal-title">Please confirm!</h2> - <button type="button" class="close red" data-dismiss="modal"> - <span>×</span> - </button> - </div> - <div class="modal-body"> - <p>Are you sure about deleting this course? This action can not be reversed!</p> - </div> - <div class="modal-footer"> - <form method="POST" action=""> - <button type="button" class="btn action-button blue" data-dismiss="modal">Cancel</button> - <input type="submit" name="submit" class="btn action-button red" value="Delete"/> - </form> + <!-- Nav tabs --> - </div> - </div> - </div> - </div> + <ul class="nav nav-tabs" role="tablist"> + <li class="nav-item"> + <a class="nav-link active" data-toggle="tab" href="#menu1">New</a> + </li> + <li class="nav-item"> + <a class="nav-link" data-toggle="tab" href="#menu2">Missed</a> + </li> + <li class="nav-item"> + <a class="nav-link" data-toggle="tab" href="#menu3">Submitted</a> + </li> + <li class="nav-item"> + <a class="nav-link" data-toggle="tab" href="#menu4">Marked</a> + </li> + + <!----------Delete Course Button-----------> + <li> + <html> + + <body> + + <div class="modal fade" id="delcourse"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h2 class="modal-title">Please confirm!</h2> + <button type="button" class="close red" data-dismiss="modal"> + <span>×</span> + </button> + </div> + <div class="modal-body"> + <p>Are you sure about deleting this course? This action can not be reversed!</p> + </div> + <div class="modal-footer"> + <form method="POST" action=""> + <button type="button" class="btn action-button blue" data-dismiss="modal">Cancel</button> + <input type="submit" name="submit" class="btn action-button red" value="Delete" /> + </form> + + </div> + </div> + </div> + </div> </div> <div class="row"> <div class="col"> @@ -134,523 +132,487 @@ if( $_SESSION['user_type'] == "Student") </div> </div> </div> -</div> - - <?php + </div> -// Connect to MySQL database -$con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr"); + <?php -// Check connection -if (mysqli_connect_errno()) -{ - echo "Failed to connect to MySQL: " . mysqli_connect_error(); -} -if(isset($_POST['submit'])){ - header("Location: Courses.php"); - $result = mysqli_query($con, "DELETE FROM course_students_table WHERE Course_ID='$course_id'"); - -} - ?> + // Connect to MySQL database + $con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr"); -<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" - integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" - crossorigin="anonymous"></script> - <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" - integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" - crossorigin="anonymous"></script> - <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" - integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" - crossorigin="anonymous"></script> - <style> - - /*--------------------[ Delete Course Button ]*/ -.action-button { - font-family: 'Pacifico', cursive; - font-size: 18px; - color: #FFF; - text-decoration: none; -} -.red { - background-color: #E74C3C; - border-bottom: 5px solid #BD3E31; - text-shadow: 0px -2px #BD3E31; -} -.blue { - background-color: #4d4dff; - border-bottom: 5px solid #4d4dff; - text-shadow: 0px -2px #4d4dff; -} -</style> -</body> -</html> -</li> - </ul> - - <div class="tab-content"> - <div id="menu1" class="container tab-pane active"><br> - -<?php - - // Get groups of this students - $sql="SELECT course_group_members_table.Course_Group_id FROM course_group_members_table INNER JOIN course_groups_table ON course_group_members_table.Course_Group_id = course_groups_table.Course_Group_id WHERE course_group_members_table.Student_ID=$student_id and course_groups_table.Course_id=$course_id"; - - $resultx1 = mysqli_query($con, $sql); - while($row = mysqli_fetch_assoc($resultx1)) - { - $_SESSION['group_id'] = $row['Course_Group_id']; - } - - $group_id = $_SESSION['group_id']; - - if($group_id == "") - { - $group_id = 0; // no group. If the student has a group, the group number should be greater than 0. + // Check connection + if (mysqli_connect_errno()) { + echo "Failed to connect to MySQL: " . mysqli_connect_error(); } + if (isset($_POST['submit'])) { + header("Location: Courses.php"); + $result = mysqli_query($con, "DELETE FROM course_students_table WHERE Course_ID='$course_id'"); + } + ?> - // Show the assignment iff the following conditions are met: (1) - // Before the deadline (2) Before the students' extended deadline (if any) - // (3) none of the student's group members have already submitted - // the assignment. + <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> + <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> + <style> + /*--------------------[ Delete Course Button ]*/ + .action-button { + font-family: 'Pacifico', cursive; + font-size: 18px; + color: #FFF; + text-decoration: none; + } - $var = "SELECT Type, Lab_Report_ID, Marks, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, lab_reports_table.Title, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4`". - " FROM `lab_reports_table`". - " WHERE Course_ID=$course_id". - " AND (Deadline > '$c_date' OR Lab_Report_ID IN (SELECT `Lab_Report_ID` FROM `extended_deadlines_table` WHERE Student_ID=$student_id AND Extended_Deadline_Date > '$c_date' AND Lab_Report_ID IN (SELECT Lab_Report_ID FROM lab_reports_table WHERE Course_ID=$course_id)))". - " AND Lab_Report_ID NOT IN (SELECT Lab_Report_ID FROM lab_report_submissions WHERE Course_Group_id IN (SELECT Course_Group_id FROM course_group_members_table WHERE Student_ID=$student_id))". - " ORDER BY Lab_Report_ID DESC"; + .red { + background-color: #E74C3C; + border-bottom: 5px solid #BD3E31; + text-shadow: 0px -2px #BD3E31; + } - $result1 = mysqli_query($con, $var); - - if(mysqli_num_rows($result1)==0) - { - echo "No active assignments for this course so far."; - } else { - - while($row = mysqli_fetch_assoc($result1)) { - $title=$row['Title']; - $type=$row['Type']; - $Marks=$row['Marks']; - $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']; - $labid=$row['Lab_Report_ID']; + .blue { + background-color: #4d4dff; + border-bottom: 5px solid #4d4dff; + text-shadow: 0px -2px #4d4dff; + } + </style> + </body> - $full_link = "<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>"; - - if($att2!=""){ - $full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>"; + </html> + </li> + </ul> + + <div class="tab-content"> + <div id="menu1" class="container tab-pane active"><br> + + <?php + + // Get groups of this students + $sql = "SELECT course_group_members_table.Course_Group_id FROM course_group_members_table INNER JOIN course_groups_table ON course_group_members_table.Course_Group_id = course_groups_table.Course_Group_id WHERE course_group_members_table.Student_ID=$student_id and course_groups_table.Course_id=$course_id"; + + $resultx1 = mysqli_query($con, $sql); + while ($row = mysqli_fetch_assoc($resultx1)) { + $_SESSION['group_id'] = $row['Course_Group_id']; } - if($att3!=""){ - $full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>"; + + $group_id = $_SESSION['group_id']; + + if ($group_id == "") { + $group_id = 0; // no group. If the student has a group, the group number should be greater than 0. } - - if($att4!=""){ - $full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>"; - } - echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'> + + // Show the assignment iff the following conditions are met: (1) + // Before the deadline (2) Before the students' extended deadline (if any) + // (3) none of the student's group members have already submitted + // the assignment. + + $var = "SELECT Type, Lab_Report_ID, Marks, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, lab_reports_table.Title, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4`" . + " FROM `lab_reports_table`" . + " WHERE Course_ID=$course_id" . + " AND (Deadline > '$c_date' OR Lab_Report_ID IN (SELECT `Lab_Report_ID` FROM `extended_deadlines_table` WHERE Student_ID=$student_id AND Extended_Deadline_Date > '$c_date' AND Lab_Report_ID IN (SELECT Lab_Report_ID FROM lab_reports_table WHERE Course_ID=$course_id)))" . + " AND Lab_Report_ID NOT IN (SELECT Lab_Report_ID FROM lab_report_submissions WHERE Course_Group_id IN (SELECT Course_Group_id FROM course_group_members_table WHERE Student_ID=$student_id))" . + " ORDER BY Lab_Report_ID DESC"; + + $result1 = mysqli_query($con, $var); + + if (mysqli_num_rows($result1) == 0) { + echo "No active assignments for this course so far."; + } else { + + while ($row = mysqli_fetch_assoc($result1)) { + $title = $row['Title']; + $type = $row['Type']; + $Marks = $row['Marks']; + $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']; + $labid = $row['Lab_Report_ID']; + + $full_link = "<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>"; + + if ($att2 != "") { + $full_link = $full_link . "| <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>"; + } + if ($att3 != "") { + $full_link = $full_link . "| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>"; + } + + if ($att4 != "") { + $full_link = $full_link . "| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>"; + } + echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'> $title ($type) <br> <span style='font-size:8pt'> $ins</span> <br> <span style='font-size:8pt'>Posted : $posted Deadline : $deadline ($Marks Marks) <a href='~\..\SubmitLab.php?id=$labid&url=$url' class='btn-sm btn-info' style='margin-left:50px;'> Submit Lab Report</a><br> Attachments : $full_link </span> </div></k>"; - - }} - echo ""; - ?> - - </div> + } + } + echo ""; + ?> + + </div> - - <div id="menu2" class="container tab-pane"><br> -<?php - $group_id=$_SESSION['group_id']; - if($group_id == ""){$group_id = -1;} // Individual assignment does not require the student to have a group id. Therefore, the group is an empty string. To make the following SQL statement work properly, initialize the group id to -1. - $result = mysqli_query($con,"SELECT Lab_Report_ID,Marks, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, lab_reports_table.Title, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4` + <div id="menu2" class="container tab-pane"><br> + + <?php + $group_id = $_SESSION['group_id']; + if ($group_id == "") { + $group_id = -1; + } // Individual assignment does not require the student to have a group id. Therefore, the group is an empty string. To make the following SQL statement work properly, initialize the group id to -1. + $result = mysqli_query($con, "SELECT Lab_Report_ID,Marks, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, lab_reports_table.Title, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4` FROM `lab_reports_table` WHERE Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (Student_id=$student_id or Course_Group_id=$group_id)) and Course_ID=$course_id and Deadline < '$c_date'" - . "" - . "" - . "" - . "" - . "" - . "" - . "ORDER by Lab_Report_ID DESC"); + . "" + . "" + . "" + . "" + . "" + . "" + . "ORDER by Lab_Report_ID DESC"); - if(mysqli_num_rows($result)==0) - { - echo "You missed no lab reports in this course."; - - } else { - while($row = mysqli_fetch_assoc($result)) { - $title=$row['Title']; - $marks=$row['Marks']; - $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']; - - - - - $full_link="<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>"; - - if($att2!=""){ - $full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>"; - } - if($att3!=""){ - $full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>"; - } - - if($att4!=""){ - $full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>"; - } - ; - - echo "<div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'><span class='btn-sm btn-warning' style='margin-left:0px;'>MISSED</span> $title ($marks Marks) <br> <span style='font-size:8pt'> $ins</span> + if (mysqli_num_rows($result) == 0) { + echo "You missed no lab reports in this course."; + } else { + while ($row = mysqli_fetch_assoc($result)) { + $title = $row['Title']; + $marks = $row['Marks']; + $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']; + + + + + $full_link = "<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>"; + + if ($att2 != "") { + $full_link = $full_link . "| <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>"; + } + if ($att3 != "") { + $full_link = $full_link . "| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>"; + } + + if ($att4 != "") { + $full_link = $full_link . "| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>"; + }; + + echo "<div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'><span class='btn-sm btn-warning' style='margin-left:0px;'>MISSED</span> $title ($marks Marks) <br> <span style='font-size:8pt'> $ins</span> <br> <span style='font-size:8pt'>Posted: $posted<br> Deadline: $deadline <br> Attachments : $full_link </span> </div>"; - - }} - echo ""; - ?> - - </div> + } + } + echo ""; + ?> + + </div> - <div id="menu3" class="container tab-pane"><br> -<?php + <div id="menu3" class="container tab-pane"><br> + <?php - $group_id = $_SESSION['group_id']; - if($group_id==""){$group_id=-1;} // This fixes "Submitted report not shown" http://118.25.96.118/bugzilla/show_bug.cgi?id=176 + $group_id = $_SESSION['group_id']; + if ($group_id == "") { + $group_id = -1; + } // This fixes "Submitted report not shown" http://118.25.96.118/bugzilla/show_bug.cgi?id=176 - $sql_stmt = "SELECT Lab_Report_ID, Marks, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, lab_reports_table.Title, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4` + $sql_stmt = "SELECT Lab_Report_ID, Marks, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, lab_reports_table.Title, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4` FROM `lab_reports_table` WHERE Lab_Report_ID in (select Lab_Report_ID from lab_report_submissions" - . " where Status='Pending' and (Student_id=$student_id or Course_Group_id=$group_id) and Course_ID=$course_id) ORDER by Lab_Report_ID DESC"; - - $resultx = mysqli_query($con, $sql_stmt); + . " where Status='Pending' and (Student_id=$student_id or Course_Group_id=$group_id) and Course_ID=$course_id) ORDER by Lab_Report_ID DESC"; + + $resultx = mysqli_query($con, $sql_stmt); - if(mysqli_num_rows($resultx)==0) - { - echo "You have no lab report submissions in this course."; - - } else { - while($row = mysqli_fetch_assoc($resultx)) { - $lab_repo_id=$row['Lab_Report_ID']; - $title=$row['Title']; - $marks=$row['Marks']; - $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']; - if( $c_date < $deadline) - { - $submittedx="<a href='~\..\SubmitLab.php?id=$id&url=$url' class='btn-sm btn-default'><i class='fa fa-check-circle'></i> Re-Submit </a>"; - } - - $full_link = "<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>"; - - if($att2!=""){ - $full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>"; - } - if($att3!=""){ - $full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>"; - } - - if($att4!=""){ - $full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>"; - } - - echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'> + if (mysqli_num_rows($resultx) == 0) { + echo "You have no lab report submissions in this course."; + } else { + while ($row = mysqli_fetch_assoc($resultx)) { + $lab_repo_id = $row['Lab_Report_ID']; + $title = $row['Title']; + $marks = $row['Marks']; + $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']; + if ($c_date < $deadline) { + $submittedx = "<a href='~\..\SubmitLab.php?id=$id&url=$url' class='btn-sm btn-default'><i class='fa fa-check-circle'></i> Re-Submit </a>"; + } + + $full_link = "<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>"; + + if ($att2 != "") { + $full_link = $full_link . "| <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>"; + } + if ($att3 != "") { + $full_link = $full_link . "| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>"; + } + + if ($att4 != "") { + $full_link = $full_link . "| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>"; + } + + echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'> $title <br> <span style='font-size:8pt'> $ins</span> <br> <span style='font-size:8pt'>Posted : $posted Deadline : $deadline ($marks Marks) $submittedx <span class='btn-sm btn-success' style='margin-left:50px;'><i class='fa fa-Edit-circle'></i> Submitted </span> <br> Submitted files: "; - $Sub_result = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID, + $Sub_result = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID, lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status, `Title`,users_table.Full_Name,course_group_members_table.Student_ID FROM `lab_report_submissions` Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id -where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$student_id')"); +where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$student_id')"); - if(mysqli_num_rows($Sub_result) == 0) - { - echo "No Attachments found."; - - } else { - while($row = mysqli_fetch_assoc($Sub_result)) { - $at1=$row['Attachment1']; - $at2=$row['Attachment2']; - $at3=$row['Attachment3']; - $at4=$row['Attachment4']; + if (mysqli_num_rows($Sub_result) == 0) { + echo "No Attachments found."; + } else { + while ($row = mysqli_fetch_assoc($Sub_result)) { + $at1 = $row['Attachment1']; + $at2 = $row['Attachment2']; + $at3 = $row['Attachment3']; + $at4 = $row['Attachment4']; - $base_at1 = basename($at1); - $base_at2 = basename($at2); - $base_at3 = basename($at3); - $base_at4 = basename($at4); - - $full_link = "<a href='~\..\Download.php?file=$at1&attachment=1'>$base_at1</a>"; // prevent students from directly accessing their classmates' submissions - - if($at2!=""){ - $full_link= $full_link." | <a href='~\..\Download.php?file=$at2&attachment=2'>$base_at2</a>"; - } - if($at3!=""){ - $full_link= $full_link." | <a href='~\..\Download.php?file=$at3&attachment=3'>$base_at3</a>"; - } - - if($at4!=""){ - $full_link= $full_link." | <a href='~\..\Download.php?file=$at4&attachment=4'>$base_at4</a>"; + $base_at1 = basename($at1); + $base_at2 = basename($at2); + $base_at3 = basename($at3); + $base_at4 = basename($at4); + + $full_link = "<a href='~\..\Download.php?file=$at1&attachment=1'>$base_at1</a>"; // prevent students from directly accessing their classmates' submissions + + if ($at2 != "") { + $full_link = $full_link . " | <a href='~\..\Download.php?file=$at2&attachment=2'>$base_at2</a>"; + } + if ($at3 != "") { + $full_link = $full_link . " | <a href='~\..\Download.php?file=$at3&attachment=3'>$base_at3</a>"; + } + + if ($at4 != "") { + $full_link = $full_link . " | <a href='~\..\Download.php?file=$at4&attachment=4'>$base_at4</a>"; + } + + echo $full_link; + } } - echo $full_link; + + + + echo "</span></div></k>"; } } + echo ""; + ?> + + + </div> + <?php + $sqli = mysqli_query($con, "SELECT * from course_groups_table WHERE Course_Group_id=$group_id and Course_id=$course_id"); + while ($row = mysqli_fetch_assoc($sqli)) { + $Group_Leader = $row['Group_Leader']; + $Group_Member = $row['Group_Member']; + $Group_Member2 = $row['Group_Member2']; + $Group_Member3 = $row['Group_Member3']; + $Group_Member4 = $row['Group_Member4']; + } + ?> - echo "</span></div></k>"; - - - }} - echo ""; - ?> - - - </div> - - - - -<?php - $sqli=mysqli_query($con, "SELECT * from course_groups_table WHERE Course_Group_id=$group_id and Course_id=$course_id"); - while($row = mysqli_fetch_assoc($sqli)) - { $Group_Leader=$row['Group_Leader']; - $Group_Member=$row['Group_Member']; - $Group_Member2=$row['Group_Member2']; - $Group_Member3=$row['Group_Member3']; - $Group_Member4=$row['Group_Member4']; - } - ?> - - - - <div id="menu4" class="container tab-pane"><br> -<?php - $resultx = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_reports_table.`Lab_Report_ID`, `Student_id`, " - . "`Course_Group_id`, `Notes`, lab_report_submissions.`Marks`, + + <div id="menu4" class="container tab-pane"><br> + <?php + $resultx = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_reports_table.`Lab_Report_ID`, `Student_id`, " + . "`Course_Group_id`, `Notes`, lab_report_submissions.`Marks`, lab_report_submissions.Remarking_Reason, `Status`, lab_reports_table.Title Lab_Title,lab_reports_table.Marks Original_marks FROM `lab_report_submissions` " - . "INNER JOIN lab_reports_table on lab_reports_table.Lab_Report_ID=lab_report_submissions.Lab_Report_ID " - . "WHERE (lab_report_submissions.Student_id='$student_id' + . "INNER JOIN lab_reports_table on lab_reports_table.Lab_Report_ID=lab_report_submissions.Lab_Report_ID " + . "WHERE (lab_report_submissions.Student_id='$student_id' or (lab_report_submissions.Student_id='$Group_Leader' and lab_report_submissions.Course_Group_id='$group_id') or (lab_report_submissions.Student_id='$Group_Member' and lab_report_submissions.Course_Group_id='$group_id') or (lab_report_submissions.Student_id='$Group_Member2' and lab_report_submissions.Course_Group_id='$group_id') or (lab_report_submissions.Student_id='$Group_Member3' and lab_report_submissions.Course_Group_id='$group_id') or (lab_report_submissions.Student_id='$Group_Member4' and lab_report_submissions.Course_Group_id='$group_id') - )and" - . "" - . "" - . "" - . " lab_reports_table.Lab_Report_ID in (select Lab_Report_ID from lab_report_submissions" - . " where (Status='Marked' or Status='Remarking') and (Student_id=$student_id or Course_Group_id=$group_id) and Course_ID=$course_id) ORDER by Submission_ID DESC"); - - + )and" + . "" + . "" + . "" + . " lab_reports_table.Lab_Report_ID in (select Lab_Report_ID from lab_report_submissions" + . " where (Status='Marked' or Status='Remarking') and (Student_id=$student_id or Course_Group_id=$group_id) and Course_ID=$course_id) ORDER by Submission_ID DESC"); - if(mysqli_num_rows($resultx)==0) - { - echo "You have no marked submissions in this course"; - - } else { while($row = mysqli_fetch_assoc($resultx)) { - $title=$row['Lab_Title']; - $marks=$row['Marks']; - $Originalmarks=$row['Original_marks']; - $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']; - $Submission_ID=$row['Submission_ID']; - $notes=$row['Notes']; - $status= $row['Status']; - $remarking_reason=$row['Remarking_Reason']; - if($status=='Marked') - { - $rm_data="\Script.php?remarking=yes&id=$Submission_ID&url=$url&status=Remarking"; - $remarking="<button onclick='remarking(\"$rm_data\")' class='btn-sm btn-success'> Request Remarking </button>"; - } - if($status=='Remarking') - { - $remarking="<span style='color:orange'><i class='fa fa-info-circle'></i> Remarking Request sent </span> <br> Remarking Reason:<i>$remarking_reason </i> <br>"; - - } - - - echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'> + + + if (mysqli_num_rows($resultx) == 0) { + echo "You have no marked submissions in this course"; + } else { + while ($row = mysqli_fetch_assoc($resultx)) { + $title = $row['Lab_Title']; + $marks = $row['Marks']; + $Originalmarks = $row['Original_marks']; + $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']; + $Submission_ID = $row['Submission_ID']; + $notes = $row['Notes']; + $status = $row['Status']; + $remarking_reason = $row['Remarking_Reason']; + if ($status == 'Marked') { + $rm_data = "\Script.php?remarking=yes&id=$Submission_ID&url=$url&status=Remarking"; + $remarking = "<button onclick='remarking(\"$rm_data\")' class='btn-sm btn-success'> Request Remarking </button>"; + } + if ($status == 'Remarking') { + $remarking = "<span style='color:orange'><i class='fa fa-info-circle'></i> Remarking Request sent </span> <br> Remarking Reason:<i>$remarking_reason </i> <br>"; + } + + + echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'> $title <b> ($marks Marks out of $Originalmarks)</b><br><small> Lecturer Feedback : $notes </small> $remarking <br> Submission files :"; - - $Sub_result = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID, + + $Sub_result = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID, lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status, `Title`,users_table.Full_Name,course_group_members_table.Student_ID FROM `lab_report_submissions` Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id - where Lab_Report_ID=$id and lab_report_submissions.Student_id='$student_id'"); - - if(mysqli_num_rows($Sub_result)==0) - { - echo "No Attachments found."; - - } else { while($row = mysqli_fetch_assoc($Sub_result)) { - $at1=$row['Attachment1']; - $at2=$row['Attachment2']; - $at3=$row['Attachment3']; - $at4=$row['Attachment4']; - - $full_link="<a href='~\..\Lab_Report_Submisions\\$at1'>$at1</a>"; - - if($at2!=""){ - $full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$at2'>$at2</a>"; + where Lab_Report_ID=$id and lab_report_submissions.Student_id='$student_id'"); + + if (mysqli_num_rows($Sub_result) == 0) { + echo "No Attachments found."; + } else { + while ($row = mysqli_fetch_assoc($Sub_result)) { + $at1 = $row['Attachment1']; + $at2 = $row['Attachment2']; + $at3 = $row['Attachment3']; + $at4 = $row['Attachment4']; + + $full_link = "<a href='~\..\Lab_Report_Submisions\\$at1'>$at1</a>"; + + if ($at2 != "") { + $full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$at2'>$at2</a>"; + } + if ($at3 != "") { + $full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$at3'>$at3</a>"; + } + + if ($at4 != "") { + $full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$at4'>$at4</a>"; + } + + echo $full_link; + } } - if($at3!=""){ - $full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$at3'>$at3</a>"; - } - - if($at4!=""){ - $full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$at4'>$at4</a>"; - } - - echo $full_link; - } } + echo "</div></k>"; + ?> + </div> - - - - - }} - echo "</div></k>"; - ?> - - - </div> - </div> - + </div> - + <div class="col-md-3"> - <h3>Class Groups</h3> - -<?php - $resultx1 = mysqli_query($con,"SELECT `Course_Group_id` FROM `course_groups_table` WHERE Course_id=$course_id"); - while($row = mysqli_fetch_assoc($resultx1)) {$count_groups=$row['Course_Group_id'];} + <h3>Class Groups</h3> - - echo " <button onclick='CreateGroup()' class='btn btn-primary'> Create Group</button>"; - - ?> - - - - <hr> -<?php - - $result = mysqli_query($con," SELECT `ID`, course_group_members_table.Course_Group_id, `Student_ID`, + <?php + $resultx1 = mysqli_query($con, "SELECT `Course_Group_id` FROM `course_groups_table` WHERE Course_id=$course_id"); + while ($row = mysqli_fetch_assoc($resultx1)) { + $count_groups = $row['Course_Group_id']; + } + + + echo " <button onclick='CreateGroup()' class='btn btn-primary'> Create Group</button>"; + + ?> + + + + <hr> + <?php + + $result = mysqli_query($con, " SELECT `ID`, course_group_members_table.Course_Group_id, `Student_ID`, `Status`,course_groups_table.Group_Name,course_groups_table.Course_id FROM `course_group_members_table` INNER JOIN course_groups_table on course_groups_table.Course_Group_id=course_group_members_table.Course_Group_id WHERE Student_id=$student_id and course_groups_table.Course_id=$course_id"); - - if(mysqli_num_rows($result)==0) - { - echo "You have no Group in this Course"; - } else { while($row = mysqli_fetch_assoc($result)) { - $name=$row['Group_Name']; - $id=$row['Course_Group_id']; - $status=$row['Status']; - - - $extra=" - <a href='#' class='' onclick='invite($id)'> Invite Others</a></small>"; - - if($status=="Invited") - { - $extra2=" <a href='#' class='' onclick='accept($id,1)'>Accept</a></small>"; - $extra3=" <a href='#' class='' onclick='accept($id,0)'>Decline</a></small>"; - - } - echo "<div class='btn-default'><small> $name ($status) $extra $extra2 $extra3</small></div>"; - - $rs2=mysqli_query($con,"SELECT `ID`, `Course_Group_id`, course_group_members_table.Student_ID, + + if (mysqli_num_rows($result) == 0) { + echo "You have no Group in this Course"; + } else { + while ($row = mysqli_fetch_assoc($result)) { + $name = $row['Group_Name']; + $id = $row['Course_Group_id']; + $status = $row['Status']; + + + $extra = " - <a href='#' class='' onclick='invite($id)'> Invite Others</a></small>"; + + if ($status == "Invited") { + $extra2 = " <a href='#' class='' onclick='accept($id,1)'>Accept</a></small>"; + $extra3 = " <a href='#' class='' onclick='accept($id,0)'>Decline</a></small>"; + } + echo "<div class='btn-default'><small> $name ($status) $extra $extra2 $extra3</small></div>"; + + $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"); - - while($row = mysqli_fetch_assoc($rs2)) { - $name=$row['Full_Name']; - $id=$row['Course_Group_id']; - $status=$row['Status']; - $Student_ID=$row['Student_ID']; - - - echo "<li><small> $name-$Student_ID ($status)</small></li>"; - - } - - - - - - - - } - } - ?> - - - - + while ($row = mysqli_fetch_assoc($rs2)) { + $name = $row['Full_Name']; + $id = $row['Course_Group_id']; + $status = $row['Status']; + $Student_ID = $row['Student_ID']; + + + echo "<li><small> $name-$Student_ID ($status)</small></li>"; + } + } + } + ?> + + + + + </div> - + </div> - + @@ -665,67 +627,68 @@ include 'Footer.php'; <link rel="stylesheet" href="./css/jquery-ui.css" /> <script> + function CreateGroup() { -function CreateGroup() { - - - try - { - - $('<form id="frm" method="get" action="Script.php"><input type="hidden" name="creategroup" value="true">\n\ + try { + + + $('<form id="frm" method="get" action="Script.php"><input type="hidden" name="creategroup" value="true">\n\ <input type="hidden" name="student_id" value="<?php echo $student_id; ?>" > Group Name <input type="text" name="name">\n\ <input type="hidden" name="url" value="<?php echo $url; ?>"> <input type="hidden" name="id" value="<?php echo $course_id; ?>"> </form>').dialog({ - modal: true, - title:'Create Group', - buttons: { - 'Create Group': function () { - $('#frm').submit(); - - $(this).dialog('close'); - }, - 'X': function () { - - $(this).dialog('close'); + modal: true, + title: 'Create Group', + buttons: { + 'Create Group': function() { + $('#frm').submit(); + + $(this).dialog('close'); + }, + 'X': function() { + + $(this).dialog('close'); + } + + } + }); + + } catch (e) { + alert(e); } - } -}); - - } catch(e){ alert(e); } -} -function invite(id) { - - - try - { - + function invite(id) { - $('<form id="frm" method="get" action="Script.php"><input type="hidden" name="groupinvite" value="true">\n\ - <input type="hidden" name="groupid" value="'+id+'" > Enter Student_ID to Invite <input type="text" name="student_id">\n\ + + try { + + + $('<form id="frm" method="get" action="Script.php"><input type="hidden" name="groupinvite" value="true">\n\ + <input type="hidden" name="groupid" value="' + id + '" > Enter Student_ID to Invite <input type="text" name="student_id">\n\ <input type="hidden" name="url" value="<?php echo $url; ?>"> <input type="hidden" name="courseid" value="<?php echo $course_id; ?>"> </form>').dialog({ - modal: true, - title:'Invite Students to Group', - buttons: { - 'Invite': function () { - $('#frm').submit(); - - $(this).dialog('close'); - }, - 'X': function () { - - $(this).dialog('close'); + modal: true, + title: 'Invite Students to Group', + buttons: { + 'Invite': function() { + $('#frm').submit(); + + $(this).dialog('close'); + }, + 'X': function() { + + $(this).dialog('close'); + } + + } + }); + + } catch (e) { + alert(e); } - } -}); - - } catch(e){ alert(e); } -} @@ -734,45 +697,43 @@ function invite(id) { -function accept(id,val) { - - try - { - + function accept(id, val) { - $('<form id="frm" method="get" action="Script.php"><input type="hidden" name="acceptinvite" value="true">\n\ - <input type="hidden" name="groupid" value="'+id+'" > \n\ <input type="hidden" name="action" value="'+val+'" > \n\ + try { + + + $('<form id="frm" method="get" action="Script.php"><input type="hidden" name="acceptinvite" value="true">\n\ + <input type="hidden" name="groupid" value="' + id + '" > \n\ <input type="hidden" name="action" value="' + val + '" > \n\ \n\ <input type="hidden" name="student_id" value="<?php echo $student_id; ?>" > \n\ <input type="hidden" name="url" value="<?php echo $url; ?>"> <input type="hidden" name="courseid" value="<?php echo $course_id; ?>"> </form>').dialog({ - modal: true, - title:'Respond to Group Invite', - buttons: { - 'Confirm': function () { - $('#frm').submit(); - - $(this).dialog('close'); - }, - 'X': function () { - - $(this).dialog('close'); + modal: true, + title: 'Respond to Group Invite', + buttons: { + 'Confirm': function() { + $('#frm').submit(); + + $(this).dialog('close'); + }, + 'X': function() { + + $(this).dialog('close'); + } + + } + }); + + } catch (e) { + alert(e); } - } -}); - - } catch(e){ alert(e); } -} -function remarking(data) -{ - - var details = prompt("Please enter your remarking reasons",""); - - window.location.href = data+"&details="+details; -} - -</script> - + function remarking(data) { + + var details = prompt("Please enter your remarking reasons", ""); + + window.location.href = data + "&details=" + details; + } +</script> \ No newline at end of file From 0fca11a8bde1641633183abb879d395847888a04 Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:09:39 +0800 Subject: [PATCH 02/16] Overview.html and .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..600d2d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode \ No newline at end of file From 30359f4667d321ff84568e4fc35ea823ed564128 Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:15:59 +0800 Subject: [PATCH 03/16] update .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 600d2d3..c1ea37f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.vscode \ No newline at end of file +.vscode +homepage/Overview.html From a3606a2938b6853f7814d22f0627dd2dcf2c7816 Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:20:27 +0800 Subject: [PATCH 04/16] udpate .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c1ea37f..dd9c765 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -.vscode +./.vscode homepage/Overview.html From 05fb239efe4ae31ea32aa29a29170a7d4f1a18a7 Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:22:42 +0800 Subject: [PATCH 05/16] no .vscode --- .vscode/extensions.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .vscode/extensions.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 5570731..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "recommendations": [ - "thamaraiselvam.remove-blank-lines" - ] -} \ No newline at end of file From 29426f102f986d7d854c93ad2df71729d3546ba2 Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:23:34 +0800 Subject: [PATCH 06/16] update .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index dd9c765..c1ea37f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -./.vscode +.vscode homepage/Overview.html From 55753cc88fbd54793edd11005590e6c25c622e3d Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:27:03 +0800 Subject: [PATCH 07/16] Courses.php: indent code. --- Course.php | 65 ------------------------------------------------------ 1 file changed, 65 deletions(-) diff --git a/Course.php b/Course.php index 0dc6dbc..8946d75 100644 --- a/Course.php +++ b/Course.php @@ -2,7 +2,6 @@ include 'NoDirectPhpAcess.php'; ?> - <?php $page = 'Courses+'; include 'Header.php'; @@ -10,7 +9,6 @@ $student_id = $_SESSION["user_student_id"]; $group_id = $_SESSION["user_group_id"]; $c_date = date("Y-m-d H:i"); - if (!empty($_GET["url"])) { $course_url = $_GET["url"]; $result = mysqli_query($con, "SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`," @@ -68,8 +66,6 @@ if (!empty($_GET["url"])) { </div> - - <?php if ($_SESSION['user_type'] == "Student") { @@ -252,9 +248,6 @@ if ($_SESSION['user_type'] == "Student") { </div> - - - <div id="menu2" class="container tab-pane"><br> <?php @@ -274,8 +267,6 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St . "" . "ORDER by Lab_Report_ID DESC"); - - if (mysqli_num_rows($result) == 0) { echo "You missed no lab reports in this course."; } else { @@ -291,9 +282,6 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St $att4 = $row['Attachment_link_4']; $id = $row['Lab_Report_ID']; - - - $full_link = "<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>"; if ($att2 != "") { @@ -317,18 +305,14 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St </div> - - <div id="menu3" class="container tab-pane"><br> <?php - $group_id = $_SESSION['group_id']; if ($group_id == "") { $group_id = -1; } // This fixes "Submitted report not shown" http://118.25.96.118/bugzilla/show_bug.cgi?id=176 - $sql_stmt = "SELECT Lab_Report_ID, Marks, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, lab_reports_table.Title, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4` FROM `lab_reports_table` WHERE Lab_Report_ID in (select Lab_Report_ID from lab_report_submissions" @@ -336,7 +320,6 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St $resultx = mysqli_query($con, $sql_stmt); - if (mysqli_num_rows($resultx) == 0) { echo "You have no lab report submissions in this course."; } else { @@ -374,7 +357,6 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St <br> <span style='font-size:8pt'>Posted : $posted Deadline : $deadline ($marks Marks) $submittedx <span class='btn-sm btn-success' style='margin-left:50px;'><i class='fa fa-Edit-circle'></i> Submitted </span> <br> Submitted files: "; - $Sub_result = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID, lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status, @@ -415,22 +397,14 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen } } - - - - echo "</span></div></k>"; } } echo ""; ?> - </div> - - - <?php $sqli = mysqli_query($con, "SELECT * from course_groups_table WHERE Course_Group_id=$group_id and Course_id=$course_id"); while ($row = mysqli_fetch_assoc($sqli)) { @@ -442,8 +416,6 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen } ?> - - <div id="menu4" class="container tab-pane"><br> <?php $resultx = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_reports_table.`Lab_Report_ID`, `Student_id`, " @@ -464,9 +436,6 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen . " lab_reports_table.Lab_Report_ID in (select Lab_Report_ID from lab_report_submissions" . " where (Status='Marked' or Status='Remarking') and (Student_id=$student_id or Course_Group_id=$group_id) and Course_ID=$course_id) ORDER by Submission_ID DESC"); - - - if (mysqli_num_rows($resultx) == 0) { echo "You have no marked submissions in this course"; } else { @@ -494,12 +463,9 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen $remarking = "<span style='color:orange'><i class='fa fa-info-circle'></i> Remarking Request sent </span> <br> Remarking Reason:<i>$remarking_reason </i> <br>"; } - echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'> $title <b> ($marks Marks out of $Originalmarks)</b><br><small> Lecturer Feedback : $notes </small> $remarking <br> Submission files :"; - - $Sub_result = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID, lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status, @@ -539,7 +505,6 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen echo "</div></k>"; ?> - </div> </div> @@ -555,13 +520,10 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen $count_groups = $row['Course_Group_id']; } - echo " <button onclick='CreateGroup()' class='btn btn-primary'> Create Group</button>"; ?> - - <hr> <?php @@ -578,7 +540,6 @@ course_groups_table.Course_Group_id=course_group_members_table.Course_Group_id W $id = $row['Course_Group_id']; $status = $row['Status']; - $extra = " - <a href='#' class='' onclick='invite($id)'> Invite Others</a></small>"; if ($status == "Invited") { @@ -598,30 +559,21 @@ where course_group_members_table.Course_Group_id=$id"); $status = $row['Status']; $Student_ID = $row['Student_ID']; - echo "<li><small> $name-$Student_ID ($status)</small></li>"; } } } ?> - - - - </div> </div> - - - <?php } include 'Footer.php'; ?> - <script src="./css/jquery-1.11.1.min.js"></script> <script src="./css/jquery-ui.min.js"></script> <link rel="stylesheet" href="./css/jquery-ui.css" /> @@ -629,10 +581,8 @@ include 'Footer.php'; <script> function CreateGroup() { - try { - $('<form id="frm" method="get" action="Script.php"><input type="hidden" name="creategroup" value="true">\n\ <input type="hidden" name="student_id" value="<?php echo $student_id; ?>" > Group Name <input type="text" name="name">\n\ <input type="hidden" name="url" value="<?php echo $url; ?>"> <input type="hidden" name="id" value="<?php echo $course_id; ?>"> </form>').dialog({ @@ -657,15 +607,10 @@ include 'Footer.php'; } } - - - function invite(id) { - try { - $('<form id="frm" method="get" action="Script.php"><input type="hidden" name="groupinvite" value="true">\n\ <input type="hidden" name="groupid" value="' + id + '" > Enter Student_ID to Invite <input type="text" name="student_id">\n\ <input type="hidden" name="url" value="<?php echo $url; ?>"> <input type="hidden" name="courseid" value="<?php echo $course_id; ?>"> </form>').dialog({ @@ -690,18 +635,10 @@ include 'Footer.php'; } } - - - - - - - function accept(id, val) { try { - $('<form id="frm" method="get" action="Script.php"><input type="hidden" name="acceptinvite" value="true">\n\ <input type="hidden" name="groupid" value="' + id + '" > \n\ <input type="hidden" name="action" value="' + val + '" > \n\ \n\ @@ -728,8 +665,6 @@ include 'Footer.php'; } } - - function remarking(data) { var details = prompt("Please enter your remarking reasons", ""); From 37ef29034b420915b7cb8ee429d1bf7e908832c8 Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:32:06 +0800 Subject: [PATCH 08/16] Footer.php: indent code --- Footer.php | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/Footer.php b/Footer.php index 08d99e8..34807bb 100644 --- a/Footer.php +++ b/Footer.php @@ -1,23 +1,4 @@ - - - - - - - - - - - - - - - - - - - <br><br><br><br><br><br><br><br><br> <div style="background-color:;width:100%di"> - + </div> \ No newline at end of file From 933a328b7e1e6706b8e049e005e8b8be24039a75 Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:33:11 +0800 Subject: [PATCH 09/16] Footer.php: add bg color. --- Footer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Footer.php b/Footer.php index 34807bb..de442d2 100644 --- a/Footer.php +++ b/Footer.php @@ -1,4 +1,4 @@ <br><br><br><br><br><br><br><br><br> -<div style="background-color:;width:100%di"> +<div style="background-color:white;width:100%di"> </div> \ No newline at end of file From ac6956d58c5f169bdd2a2f893379c79f5acc0d77 Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:34:13 +0800 Subject: [PATCH 10/16] Header.php: indent code. --- Header.php | 266 +++++++++++++++++++++++++++-------------------------- 1 file changed, 135 insertions(+), 131 deletions(-) diff --git a/Header.php b/Header.php index 6899665..60977ba 100644 --- a/Header.php +++ b/Header.php @@ -13,155 +13,159 @@ if (mysqli_connect_errno()) { ?> - <!DOCTYPE html> <html> <head> -<link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css"/> -<link href="./font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/> -<link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css"/> - -<script src="./css/jquery.min.js" type="text/javascript"></script> -<script src="./css/bootsrap.min.js" type="text/javascript"></script> -<script src="./css/jquery.datetimepicker.min.js" type="text/javascript"></script> + <link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css" /> + <link href="./font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" /> + <link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css" /> + <script src="./css/jquery.min.js" type="text/javascript"></script> + <script src="./css/bootsrap.min.js" type="text/javascript"></script> + <script src="./css/jquery.datetimepicker.min.js" type="text/javascript"></script> </head> - <body> -<nav class="navbar navbar-expand-lg navbar-dark bg-dark" style="padding-left:150px;padding-right:150px;margin:auto;"> - <a class="navbar-brand" href="~\..\index.php"> <img src="logo.png" style="width:30px;heigh:30px;"> LRR </a> - <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation"> - <span class="navbar-toggler-icon"></span> - </button> + <nav class="navbar navbar-expand-lg navbar-dark bg-dark" style="padding-left:150px;padding-right:150px;margin:auto;"> + <a class="navbar-brand" href="~\..\index.php"> <img src="logo.png" style="width:30px;heigh:30px;"> LRR </a> + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> - <div class="collapse navbar-collapse" id="navbarColor02"> - <ul class="navbar-nav mr-auto"> - <li class="nav-item active"> - - <li class="nav-item active"> - <!-- <a class='nav-link' href='~\..\Visitors.php'> <i class='fa fa-globe'></i> Visitor Portal <span class='sr-only'>(current)</span></a> --> - </li> - <?php - if(isset($_SESSION["user_fullname"])) - { - - echo " <a class='nav-link' href='~\..\Courses.php'><i class='fa fa-book'></i> Courses <span class='sr-only'>(current)</span></a>"; - ?> - </li> - </ul> - <form class="form-inline my-2 my-lg-0" style="color:#fff;"> - Welcome <b> <?php echo $_SESSION['user_fullname']; ?> </b> - + <div class="collapse navbar-collapse" id="navbarColor02"> + <ul class="navbar-nav mr-auto"> + <li class="nav-item active"> + + <li class="nav-item active"> + <!-- <a class='nav-link' href='~\..\Visitors.php'> <i class='fa fa-globe'></i> Visitor Portal <span class='sr-only'>(current)</span></a> --> + </li> <?php - $c_date= date("Y-m-d H:i"); - if (isset( $_SESSION['user_student_id'])) - echo "(". $_SESSION['user_type'] . " - " . $_SESSION['user_student_id'] .") "; - else - echo "(". $_SESSION['user_type'] .") "; + if (isset($_SESSION["user_fullname"])) { + + echo " <a class='nav-link' href='~\..\Courses.php'><i class='fa fa-book'></i> Courses <span class='sr-only'>(current)</span></a>"; ?> - -<?php -if ($_SESSION['user_type'] == "Lecturer") { - echo " <i class=\"fa fa-cog\" style=\"color:#fff;\"> </i> <a style='color:#fff !important' href=\"~\..\Admin.php\">Admin </a>"; -} -?> - - <i class="fa fa-user" style="color:#fff;"> </i> - <a href="#" style='color:#fff !important' onclick="updatePass(<?php echo $_SESSION['user_id'];?>)">Update password</a> - <i class="fa fa-lock" style="color:#fff;"> </i> <a style='color:#fff !important' href="~\..\logout.php">Logout </a> - - <?php + </li> + </ul> + <form class="form-inline my-2 my-lg-0" style="color:#fff;"> + Welcome <b> <?php echo $_SESSION['user_fullname']; ?> </b> + + <?php + $c_date = date("Y-m-d H:i"); + if (isset($_SESSION['user_student_id'])) + echo "(" . $_SESSION['user_type'] . " - " . $_SESSION['user_student_id'] . ") "; + else + echo "(" . $_SESSION['user_type'] . ") "; + ?> + + <?php + if ($_SESSION['user_type'] == "Lecturer") { + echo " <i class=\"fa fa-cog\" style=\"color:#fff;\"> </i> <a style='color:#fff !important' href=\"~\..\Admin.php\">Admin </a>"; } - ?> - </form> - </div> -</nav> - - - - <style> - .nav-item{ - border-color:#00ff66; - } - .nav-tabs{ - border-color:#00ff66; - } - - - .btn-default{ - border: 2px solid #00ff66; - width: 100%; - text-align:left; - margin:3px auto; - font-weight:bold; - font-size:13pt; - } - - .table-bordered{ - padding:5px !important; - } - - .alert{ - font-weight: bold; - } - 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; -} - - - - .ui-widget-content.ui-dialog -{ - border: 2px solid #03488B; - -} -.ui-dialog > .ui-widget-header {background: #03488B; color:white} - - .ui-button{ background: #03488B; color:white } + <i class="fa fa-user" style="color:#fff;"> </i> + <a href="#" style='color:#fff !important' onclick="updatePass(<?php echo $_SESSION['user_id']; ?>)">Update password</a> + <i class="fa fa-lock" style="color:#fff;"> </i> <a style='color:#fff !important' href="~\..\logout.php">Logout </a> - </style> - - - -<script> - function updatePass(id) - { - - var pass = prompt("Enter your new password : ", "Enter a strong password"); - - if(!confirm('Are you sure you want to reset your password?')) - { - return; - } + <?php + } + ?> + </form> + </div> + </nav> - window.location.href="\Script.php\?action=passchange&uid="+id+"&pass="+pass; + <style> + .nav-item { + border-color: #00ff66; } - - function blockUser(id,status) - { - if(!confirm('Are you sure you want to change user status?')) - { - return; + + .nav-tabs { + border-color: #00ff66; + } + + .btn-default { + border: 2px solid #00ff66; + width: 100%; + text-align: left; + margin: 3px auto; + font-weight: bold; + font-size: 13pt; + } + + .table-bordered { + padding: 5px !important; + } + + .alert { + font-weight: bold; + } + + 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; + } + + .ui-widget-content.ui-dialog { + border: 2px solid #03488B; + + } + + .ui-dialog>.ui-widget-header { + background: #03488B; + color: white + } + + .ui-button { + background: #03488B; + color: white + } + </style> + + <script> + function updatePass(id) { + + var pass = prompt("Enter your new password : ", "Enter a strong password"); + + if (!confirm('Are you sure you want to reset your password?')) { + return; } - window.location.href="\Script.php\?action=statuschange&uid="+id+"&status="+status; - } -</script> + + window.location.href = "\Script.php\?action=passchange&uid=" + id + "&pass=" + pass; + } + + function blockUser(id, status) { + if (!confirm('Are you sure you want to change user status?')) { + return; + } + window.location.href = "\Script.php\?action=statuschange&uid=" + id + "&status=" + status; + } + </script> \ No newline at end of file From d2509e8de589ad4339d8fa350e674b6da9452c00 Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:36:21 +0800 Subject: [PATCH 11/16] logout.php: indent code and add matching ?>. --- logout.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/logout.php b/logout.php index d09c644..ad306cc 100644 --- a/logout.php +++ b/logout.php @@ -2,9 +2,9 @@ // Destory sessions & redirect to index - session_destroy(); - session_unset(); - // Start a new session +session_destroy(); +session_unset(); +// Start a new session session_start(); // Generate a new session ID @@ -12,11 +12,12 @@ session_regenerate_id(true); // Then finally, make sure you pick up the new session ID $session_id = session_id(); - - - unset( $_SESSION['user_id']); - unset( $_SESSION['user_email']); - unset( $_SESSION['user_type']); - unset( $_SESSION['user_student_id']); - unset( $_SESSION['user_fullname']); + +unset($_SESSION['user_id']); +unset($_SESSION['user_email']); +unset($_SESSION['user_type']); +unset($_SESSION['user_student_id']); +unset($_SESSION['user_fullname']); header("Location: index.php"); + +?> From f30306682e81df713f05ee9e912e5203ac6335a9 Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:37:47 +0800 Subject: [PATCH 12/16] Script.php: indent code --- Script.php | 1195 +++++++++++++++++++++------------------------------- 1 file changed, 481 insertions(+), 714 deletions(-) diff --git a/Script.php b/Script.php index d1921c7..154a144 100644 --- a/Script.php +++ b/Script.php @@ -1,5 +1,5 @@ <?php - include 'NoDirectPhpAcess.php'; +include 'NoDirectPhpAcess.php'; ?> <?php @@ -17,21 +17,16 @@ include "get_mysql_credentials.php"; $con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr"); // Check connection -if (mysqli_connect_errno()) -{ +if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } - error_reporting(0); - - - - // #### FUNCTION CHECK FILE TYPES //// -function is_valid_student_number($student_id) { +function is_valid_student_number($student_id) +{ // zjnu student number has 12 digits, and starts with 20 if (strlen($student_id) == 12 && is_numeric($student_id) == TRUE && substr($student_id, 0, 2) == "20") return TRUE; @@ -40,45 +35,40 @@ function is_valid_student_number($student_id) { // ############################### SIGN UP ################################## if (!empty($_POST["frm_signup_1"])) { - - $student_id = trim( mysqli_real_escape_string($con, $_POST["student_id"]) ); + + $student_id = trim(mysqli_real_escape_string($con, $_POST["student_id"])); // validate student number - if (! is_valid_student_number($student_id)) { + if (!is_valid_student_number($student_id)) { $_SESSION["info_signup1"] = "Invalid student number."; header("Location: index.php"); - return; + return; } // Check if this student number is a legal one - $result = mysqli_query($con, "SELECT * FROM `students_data` WHERE Student_ID='$student_id'"); - if(mysqli_num_rows($result) == 0) - { + $result = mysqli_query($con, "SELECT * FROM `students_data` WHERE Student_ID='$student_id'"); + if (mysqli_num_rows($result) == 0) { $_SESSION["info_signup1"] = "Your entered student number could not be verified. Please contact Student Management Office <lanhui at zjnu.edu.cn>. Thanks."; - header("Location: index.php"); - return; + header("Location: index.php"); + return; } - + $result98 = mysqli_query($con, "SELECT * FROM `users_table` WHERE Student_ID='$student_id'"); - if(mysqli_num_rows($result98) == 0) - { + if (mysqli_num_rows($result98) == 0) { $_SESSION['user_student_id'] = $student_id; header("Location: signup.php"); return; - } - else - { + } else { $_SESSION["info_signup1"] = "This Student ID is already in use! Please contact Student Management Office <lanhui at zjnu.edu.cn> for help."; header("Location: index.php"); - return; - } + return; + } } - // ############################### CREATE STUDENT USER ################################## if (!empty($_POST["frm_signup_2"])) { $fullname = mysqli_real_escape_string($con, $_POST["fullname"]); - $student_id = mysqli_real_escape_string ($con, $_POST["user_student_id"]); + $student_id = mysqli_real_escape_string($con, $_POST["user_student_id"]); $email = mysqli_real_escape_string($con, $_POST["email"]); $password = mysqli_real_escape_string($con, $_POST["password"]); $confirmpassword = mysqli_real_escape_string($con, $_POST["confirmpassword"]); @@ -87,7 +77,7 @@ if (!empty($_POST["frm_signup_2"])) { $_SESSION['user_email'] = $email; // check confirmed password - if ( strcasecmp( $password, $confirmpassword ) != 0 ){ + if (strcasecmp($password, $confirmpassword) != 0) { $_SESSION['info_signup2'] = "Password confirmation failed."; $_SESSION['user_fullname'] = null; // such that Header.php do not show the header information. header("Location: signup.php"); @@ -100,7 +90,7 @@ if (!empty($_POST["frm_signup_2"])) { header("Location: signup.php"); return; } - + $upperLetter = preg_match('@[A-Z]@', $password); $smallLetter = preg_match('@[a-z]@', $password); $containsDigit = preg_match('@[0-9]@', $password); @@ -108,7 +98,7 @@ if (!empty($_POST["frm_signup_2"])) { $containsAll = $upperLetter && $smallLetter && $containsDigit && $containsSpecial; // check for strong password - if(! $containsAll) { + if (!$containsAll) { $_SESSION['info_signup2'] = "Password must have at least characters that include lowercase letters, uppercase letters, numbers and sepcial characters (e.g., !?.,*^)."; header("Location: signup.php"); return; @@ -116,43 +106,39 @@ if (!empty($_POST["frm_signup_2"])) { // check if email is taken $result = mysqli_query($con, "SELECT * FROM users_table WHERE email='$email'"); - if(mysqli_num_rows($result) != 0) - { - $_SESSION["info_signup2"]="Email adress ".$email." is already in use."; + if (mysqli_num_rows($result) != 0) { + $_SESSION["info_signup2"] = "Email adress " . $email . " is already in use."; $_SESSION['user_fullname'] = null; - header("Location: signup.php"); - return; + header("Location: signup.php"); + return; } // apply password_hash() $password_hash = password_hash($password, PASSWORD_DEFAULT); - $sql= "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`, `Student_ID`) VALUES " + $sql = "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`, `Student_ID`) VALUES " . "('$email','$password_hash','$fullname','Student','$student_id')"; - + if ($con->query($sql) === TRUE) { - header("Location: Courses.php"); + header("Location: Courses.php"); } else { echo "Something really bad (SQL insertion error) happened during sign up."; } } - - - // ################################ LOGIN ##################################### if (!empty($_POST["frm_login"])) { - + $user = mysqli_real_escape_string($con, $_POST["user"]); // user could be a 12-digit student number or an email address $is_student_number = 0; - + // Validate student number - if ( is_valid_student_number($user) ) { - $is_student_number = 1; + if (is_valid_student_number($user)) { + $is_student_number = 1; } - + // Validate email address if what provided is not a student number - if (! $is_student_number && !filter_var($user, FILTER_VALIDATE_EMAIL)) { + if (!$is_student_number && !filter_var($user, FILTER_VALIDATE_EMAIL)) { $_SESSION["info_login"] = "Invalid email address: " . "$user"; header("Location: index.php"); return; @@ -160,208 +146,169 @@ if (!empty($_POST["frm_login"])) { $password = mysqli_real_escape_string($con, $_POST["password"]); $result = mysqli_query($con, "SELECT * FROM users_table WHERE (Student_ID='$user') OR (Email='$user')"); - if(mysqli_num_rows($result) == 0) - { + if (mysqli_num_rows($result) == 0) { $_SESSION["info_login"] = "Inavlid user name information."; echo $_SESSION["info_login"]; - header("Location: index.php"); - } - else - { - while($row = mysqli_fetch_assoc($result)) { + header("Location: index.php"); + } else { + while ($row = mysqli_fetch_assoc($result)) { // verify the hashed password and unhashed password $sha512pass = hash('sha512', $password); // for backward compatibility. Old passwords were hashed using SHA512 algorithm. - if(password_verify($password, $row["Password"]) or $sha512pass == $row["HashPassword"]) { + if (password_verify($password, $row["Password"]) or $sha512pass == $row["HashPassword"]) { $_SESSION['user_id'] = $row['User_ID']; $_SESSION['user_email'] = $row['Email']; $_SESSION['user_student_id'] = $row['Student_ID']; $_SESSION['user_type'] = $row['UserType']; $_SESSION['user_fullname'] = $row['Full_Name']; - - if( $_SESSION['user_type'] == "Student") - { - header("Location: Courses.php"); - } - if( $_SESSION['user_type'] == "Lecturer") - { + if ($_SESSION['user_type'] == "Student") { header("Location: Courses.php"); } - - if( $_SESSION['user_type'] == "TA") - { + + if ($_SESSION['user_type'] == "Lecturer") { header("Location: Courses.php"); } - - if( $_SESSION['user_type'] == "Admin") - { + + if ($_SESSION['user_type'] == "TA") { + header("Location: Courses.php"); + } + + if ($_SESSION['user_type'] == "Admin") { header("Location: Admin.php"); } - // report wrong pass if not correct + // report wrong pass if not correct } else { $_SESSION["wrong_pass"] = "Wrong Password."; - header("Location: index.php"); + header("Location: index.php"); } } } } - - - - // ################################ Recover Password ##################################### if (!empty($_POST["frm_recover_password"])) { - $student_id = mysqli_real_escape_string($con,$_POST["sno"]); - $email = mysqli_real_escape_string($con,$_POST["email"]); + $student_id = mysqli_real_escape_string($con, $_POST["sno"]); + $email = mysqli_real_escape_string($con, $_POST["email"]); // validate student number if (strlen($student_id) != 12 || is_numeric($student_id) == FALSE) { - $_SESSION["info_recover_password"]="Invalid student number."; + $_SESSION["info_recover_password"] = "Invalid student number."; #echo "Invalid student number."; header("Location: recover_password.php"); - return; + return; } // validate email if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { - $_SESSION["info_recover_password"]="Invalid email address."; + $_SESSION["info_recover_password"] = "Invalid email address."; // echo "Invalid email address."; header("Location: recover_password.php"); return; } - $result = mysqli_query($con, "SELECT * FROM users_table WHERE Email='$email' and Student_ID='$student_id'"); - if(mysqli_num_rows($result)==0) - { - $_SESSION["info_recover_password"]="Email address is not recognised."; + if (mysqli_num_rows($result) == 0) { + $_SESSION["info_recover_password"] = "Email address is not recognised."; $_SESSION["info_recover_password"] = "Identity not recognized. Try again or send an inquiry email message to lanhui at zjnu.edu.cn."; - header("Location: recover_password.php"); - } else - { + header("Location: recover_password.php"); + } else { $result = mysqli_query($con, "DELETE FROM users_table WHERE Email='$email' and Student_ID='$student_id'"); header("Location: signup.php"); } } - - - - // ################################ RESET Password ##################################### if (!empty($_POST["frm_reset_password"])) { - $password=mysqli_real_escape_string($con,$_POST["password"]); - $token=mysqli_real_escape_string($con,$_POST["token"]); - $email=mysqli_real_escape_string($con,$_POST["email"]); - $result = mysqli_query($con, - "SELECT * FROM Users_Table WHERE email='$email'"); - if(mysqli_num_rows($result)==0) - { - + $password = mysqli_real_escape_string($con, $_POST["password"]); + $token = mysqli_real_escape_string($con, $_POST["token"]); + $email = mysqli_real_escape_string($con, $_POST["email"]); + $result = mysqli_query( + $con, + "SELECT * FROM Users_Table WHERE email='$email'" + ); + if (mysqli_num_rows($result) == 0) { + echo "invalid email"; return; - - } - else - { - while($row = mysqli_fetch_assoc($result)) { + } else { + while ($row = mysqli_fetch_assoc($result)) { - $userid=$row['User_ID']; + $userid = $row['User_ID']; - $email=$row['Email']; - $id=$row['Student_ID']; - - $user_token=$userid*$userid*$userid+$userid*0.00343; - if($user_token==$token) - { + $email = $row['Email']; + $id = $row['Student_ID']; + + $user_token = $userid * $userid * $userid + $userid * 0.00343; + if ($user_token == $token) { // Password Update // Password Update - $hashed_password=hash('sha512', $password); - $sql= "UPDATE users_table set HashPassword='$hashed_password' where User_ID=$userid;"; + $hashed_password = hash('sha512', $password); + $sql = "UPDATE users_table set HashPassword='$hashed_password' where User_ID=$userid;"; if ($con->query($sql) === TRUE) { - + error_reporting(0); - $_SESSION["info_login"]=" Password changed successfully , you can login now with your new password "; + $_SESSION["info_login"] = " Password changed successfully , you can login now with your new password "; header("Location: index.php"); - - } - else { + } else { echo "Error: " . $sql . "<br>" . $con->error; } - - } else - { + } else { echo "Invalid Token "; } - - - - } } } - - - - // ############################### CREATE Lecturer/TA USER ################################## if (!empty($_POST["frm_createlecturrer"])) { - $email=mysqli_real_escape_string($con,$_POST["email"]); - $fullname=mysqli_real_escape_string($con,$_POST["fullname"]); - $type=mysqli_real_escape_string($con,$_POST["type"]); - $password=$passport; + $email = mysqli_real_escape_string($con, $_POST["email"]); + $fullname = mysqli_real_escape_string($con, $_POST["fullname"]); + $type = mysqli_real_escape_string($con, $_POST["type"]); + $password = $passport; // check if email is taken - $result = mysqli_query($con, - "SELECT * FROM Users_Table WHERE email='$email'"); - if(mysqli_num_rows($result)!=0) - { - $_SESSION["info_Admin_Users"]="Email adress : ".$email." is already in use."; - header("Location: Admin.php"); + $result = mysqli_query( + $con, + "SELECT * FROM Users_Table WHERE email='$email'" + ); + if (mysqli_num_rows($result) != 0) { + $_SESSION["info_Admin_Users"] = "Email adress : " . $email . " is already in use."; + header("Location: Admin.php"); } - $sql= "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`) VALUES " + $sql = "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`) VALUES " . "('$email','$password','$fullname','$type')"; - + if ($con->query($sql) === TRUE) { - $_SESSION["info_Admin_Users"]=$type." user Created successfully : email ".$email." and $password as Password."; - header("Location: Admin.php"); - + $_SESSION["info_Admin_Users"] = $type . " user Created successfully : email " . $email . " and $password as Password."; + header("Location: Admin.php"); } else { echo "Error: " . $sql . "<br>" . $con->error; } } - - - - // #### FUNCTION CHECK FILE TYPES //// -function is_valid_file_format($file) { - - - $allowed = array('pdf', 'rtf', 'jpg','png', 'doc', 'docx', 'xls', 'xlsx','sql','txt','md','py','css','html', - 'cvc','c','class','cpp','h','java','sh','swift','zip','rar','ods','xlr','bak','ico','swf'); - +function is_valid_file_format($file) +{ + + $allowed = array( + 'pdf', 'rtf', 'jpg', 'png', 'doc', 'docx', 'xls', 'xlsx', 'sql', 'txt', 'md', 'py', 'css', 'html', + 'cvc', 'c', 'class', 'cpp', 'h', 'java', 'sh', 'swift', 'zip', 'rar', 'ods', 'xlr', 'bak', 'ico', 'swf' + ); + $filename = $_FILES[$file]['name']; $ext = pathinfo($filename, PATHINFO_EXTENSION); - $result = in_array($ext,$allowed); + $result = in_array($ext, $allowed); return $result; } - - - - // #### FUNCTION CREATE DIRECTORIES //// - + function Create_dir($upPath) { try { @@ -369,21 +316,19 @@ function Create_dir($upPath) $tags = explode('/', $upPath); // explode the full path $mkDir = ""; - foreach($tags as $folder) { - $mkDir = $mkDir . $folder ."/"; // make one directory join one other for the nest directory to make - echo '"'.$mkDir.'"<br/>'; // this will show the directory created each time - if(!is_dir($mkDir)) { // check if directory exist or not + foreach ($tags as $folder) { + $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make + echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time + if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } - } - } - catch (Exception $e) { + } + } catch (Exception $e) { return FALSE; } return $upPath; } - function mkdirs($path) { if (file_exists($path)) @@ -395,255 +340,230 @@ function mkdirs($path) return $result; } - - // ############################### #Post Assignment ################################## if (!empty($_POST["frm_uploadlab"])) { - - - - $course_id=mysqli_real_escape_string($con,$_POST["course_id"]); - $deadlinedate=$_POST["deadlinedate"]; - $deadlinetime=$_POST["deadlinetime"]; - $instructions=mysqli_real_escape_string($con,$_POST["instructions"]); - $title=mysqli_real_escape_string($con,$_POST["title"]); - $marks=mysqli_real_escape_string($con,$_POST["marks"]); + + $course_id = mysqli_real_escape_string($con, $_POST["course_id"]); + $deadlinedate = $_POST["deadlinedate"]; + $deadlinetime = $_POST["deadlinetime"]; + $instructions = mysqli_real_escape_string($con, $_POST["instructions"]); + $title = mysqli_real_escape_string($con, $_POST["title"]); + $marks = mysqli_real_escape_string($con, $_POST["marks"]); // $url=mysqli_real_escape_string($con,$_POST["url"]); $url = $_SESSION['url']; //using real_escape_string was failing to redirect to the main page $type = mysqli_real_escape_string($con, $_POST["type"]); - - - $deadline = $deadlinedate." ".$deadlinetime; + + $deadline = $deadlinedate . " " . $deadlinetime; $date = date("Y-m-d H:i:s"); - - - + // GET UPLOADED FILES - - $target_dir = Create_dir("Lab_Report_Assignments/".$title."/"); + $target_dir = Create_dir("Lab_Report_Assignments/" . $title . "/"); - $rnd=rand(10,1000); - $rnd=""; // no more required , creating folder for each lab - $targetfile = $target_dir.$rnd.$_FILES['attachment1']['name']; - $targetfile2 = $target_dir.$rnd.$_FILES['attachment2']['name']; - $targetfile3 = $target_dir.$rnd.$_FILES['attachment3']['name']; - $targetfile4 = $target_dir.$rnd.$_FILES['attachment4']['name']; - - + $rnd = rand(10, 1000); + $rnd = ""; // no more required , creating folder for each lab + $targetfile = $target_dir . $rnd . $_FILES['attachment1']['name']; + $targetfile2 = $target_dir . $rnd . $_FILES['attachment2']['name']; + $targetfile3 = $target_dir . $rnd . $_FILES['attachment3']['name']; + $targetfile4 = $target_dir . $rnd . $_FILES['attachment4']['name']; - $count=0; - - - if(!is_valid_file_format("attachment1") && $_FILES["attachment1"]["name"]!="") - { + $count = 0; + + if (!is_valid_file_format("attachment1") && $_FILES["attachment1"]["name"] != "") { echo "Invalid File Type for Attachment 1"; return; } - if(!is_valid_file_format("attachment2") && $_FILES["attachment2"]["name"]!="") - { + if (!is_valid_file_format("attachment2") && $_FILES["attachment2"]["name"] != "") { echo "Invalid File Type for Attachment 2"; return; } - if(!is_valid_file_format("attachment3") && $_FILES["attachment3"]["name"]!="") - { + if (!is_valid_file_format("attachment3") && $_FILES["attachment3"]["name"] != "") { echo "Invalid File Type for Attachment 3"; return; } - + // use 4 for missing file if (move_uploaded_file($_FILES['attachment1']['tmp_name'], $targetfile)) { $count++; - } else { + } else { echo $_FILES['attachment1']['error']; } - + if (move_uploaded_file($_FILES['attachment2']['tmp_name'], $targetfile2)) { $count++; - } else { + } else { echo $_FILES['attachment2']['error']; } - + if (move_uploaded_file($_FILES['attachment3']['tmp_name'], $targetfile3)) { $count++; - } else { + } else { echo $_FILES['attachment3']['error']; } - + if (move_uploaded_file($_FILES['attachment4']['tmp_name'], $targetfile4)) { $count++; - } else { + } else { echo $_FILES['attachment4']['error']; } - - - echo $count." File(s) uploaded"; - + + echo $count . " File(s) uploaded"; + //CLEAN - $targetfile=""; - $targetfile2=""; - $targetfile3=""; - $targetfile4=""; - - if($_FILES['attachment1']['name']!=""){ $targetfile = "/".$title."/".$_FILES['attachment1']['name']; } - if($_FILES['attachment2']['name']!=""){ $targetfile2 = "/".$title."/".$_FILES['attachment2']['name']; } - if($_FILES['attachment3']['name']!=""){ $targetfile3 = "/".$title."/".$_FILES['attachment3']['name']; } - if($_FILES['attachment4']['name']!=""){ $targetfile4 = "/".$title."/".$_FILES['attachment4']['name']; } - - $sql="INSERT INTO `lab_reports_table`(`Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, + $targetfile = ""; + $targetfile2 = ""; + $targetfile3 = ""; + $targetfile4 = ""; + + if ($_FILES['attachment1']['name'] != "") { + $targetfile = "/" . $title . "/" . $_FILES['attachment1']['name']; + } + if ($_FILES['attachment2']['name'] != "") { + $targetfile2 = "/" . $title . "/" . $_FILES['attachment2']['name']; + } + if ($_FILES['attachment3']['name'] != "") { + $targetfile3 = "/" . $title . "/" . $_FILES['attachment3']['name']; + } + if ($_FILES['attachment4']['name'] != "") { + $targetfile4 = "/" . $title . "/" . $_FILES['attachment4']['name']; + } + + $sql = "INSERT INTO `lab_reports_table`(`Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, `Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4`,Marks,Type) VALUES ('$course_id','$date','$deadline','$instructions','$title','$targetfile','$targetfile2','$targetfile3','$targetfile3',$marks,'$type')"; - - - + if ($con->query($sql) === TRUE) { - - $_SESSION["info_courses"] = $type." lab report assignment posted successfully."; - header("Location: Courses.php?course=".$url); - + + $_SESSION["info_courses"] = $type . " lab report assignment posted successfully."; + header("Location: Courses.php?course=" . $url); } else { echo "Error: " . $sql . "<br>" . $con->error; } } - - - - function checksize($file) { - $result = $_FILES["$file"]['size']/(1024*1024); - - if($result > 1) - { + $result = $_FILES["$file"]['size'] / (1024 * 1024); + + if ($result > 1) { return FALSE; } return TRUE; } - - - + // ############################### Submit Assignment ################################## if (!empty($_POST["frm_submitlab"])) { - + $lab_id = mysqli_real_escape_string($con, $_POST["lab_id"]); $student_id = $_POST["student_id"]; $group_id = $_POST["group_id"]; - + $instructions = mysqli_real_escape_string($con, $_POST["instructions"]); $title = mysqli_real_escape_string($con, $_POST["title"]); - + $url = mysqli_real_escape_string($con, $_POST["url"]); - - $deadline = $deadlinedate." ".$deadlinetime; + + $deadline = $deadlinedate . " " . $deadlinetime; $date = date("Y-m-d H:i:s"); - + // GET UPLOADED FILES - $labName = mysqli_query($con,"SELECT * FROM `lab_reports_table` WHERE Lab_Report_ID=$lab_id"); - while($row = mysqli_fetch_assoc($labName)) - { + $labName = mysqli_query($con, "SELECT * FROM `lab_reports_table` WHERE Lab_Report_ID=$lab_id"); + while ($row = mysqli_fetch_assoc($labName)) { $lab_name = $row['Title']; $_SESSION['Sub_Type'] = $row['Type']; // submission type, either Individual or Group - } + } $upload_folder = "Lab_Report_Submisions"; // old place for storing students' submissions $upload_folder = "./../../lrr_submission"; - $target_dir = mkdirs($upload_folder."/".$student_id."/".$url."/".$lab_name."/"); # url is actually course code plus academic year, e.g., CSC3122020 - $targetfile = $target_dir.$_FILES['attachment1']['name']; - $targetfile2 = $target_dir.$_FILES['attachment2']['name']; - $targetfile3 = $target_dir.$_FILES['attachment3']['name']; - $targetfile4 = $target_dir.$_FILES['attachment4']['name']; - + $target_dir = mkdirs($upload_folder . "/" . $student_id . "/" . $url . "/" . $lab_name . "/"); # url is actually course code plus academic year, e.g., CSC3122020 + $targetfile = $target_dir . $_FILES['attachment1']['name']; + $targetfile2 = $target_dir . $_FILES['attachment2']['name']; + $targetfile3 = $target_dir . $_FILES['attachment3']['name']; + $targetfile4 = $target_dir . $_FILES['attachment4']['name']; + $count = 0; - + //check zise - if(!checksize("attachment1")) - { + if (!checksize("attachment1")) { echo "1 MB is the maximum file size allowed"; return; } - if(!checksize("attachment2") && $_FILES["attachment2"]["name"] != "") - { + if (!checksize("attachment2") && $_FILES["attachment2"]["name"] != "") { echo "1 MB is the maximum file size allowed"; return; } - if(!checksize("attachment3") && $_FILES["attachment3"]["name"] != "") - { + if (!checksize("attachment3") && $_FILES["attachment3"]["name"] != "") { echo "1 MB is the maximum file size allowed"; return; } - - - if(!is_valid_file_format("attachment1")) - { + if (!is_valid_file_format("attachment1")) { echo "Invalid File Type for Attachment 1"; return; } - if(!is_valid_file_format("attachment2") && $_FILES["attachment2"]["name"] != "") - { + if (!is_valid_file_format("attachment2") && $_FILES["attachment2"]["name"] != "") { echo "Invalid File Type for Attachment 2"; return; } - if(!is_valid_file_format("attachment3") && $_FILES["attachment3"]["name"] != "") - { + if (!is_valid_file_format("attachment3") && $_FILES["attachment3"]["name"] != "") { echo "Invalid File Type for Attachment 3"; return; } - if($_FILES["attachment1"]["error"] != 0) { + if ($_FILES["attachment1"]["error"] != 0) { echo "Error when uploading the file."; return; - } + } // use 4 for missing file if (move_uploaded_file($_FILES['attachment1']['tmp_name'], $targetfile)) { $count++; - } else { + } else { echo $_FILES['attachment1']['error']; } if (move_uploaded_file($_FILES['attachment2']['tmp_name'], $targetfile2)) { $count++; - } else { + } else { echo $_FILES['attachment2']['error']; } if (move_uploaded_file($_FILES['attachment3']['tmp_name'], $targetfile3)) { $count++; - } else { + } else { echo $_FILES['attachment3']['error']; } if (move_uploaded_file($_FILES['attachment4']['tmp_name'], $targetfile4)) { $count++; - } else { + } else { echo $_FILES['attachment4']['error']; } - - echo $count." File(s) uploaded"; + echo $count . " File(s) uploaded"; //CLEAN $targetfile1 = ""; $targetfile2 = ""; - $targetfile3 = ""; + $targetfile3 = ""; $targetfile4 = ""; - if(strlen($_FILES['attachment1']['name']) > 2 ) { // why greater than 2??? - $targetfile = "/".$student_id."/".$url."/".$lab_name."/".rawurlencode($_FILES['attachment1']['name']); + if (strlen($_FILES['attachment1']['name']) > 2) { // why greater than 2??? + $targetfile = "/" . $student_id . "/" . $url . "/" . $lab_name . "/" . rawurlencode($_FILES['attachment1']['name']); } - - if(strlen($_FILES['attachment2']['name']) > 2 ) { - $targetfile2 = "/".$student_id."/".$url."/".$lab_name."/".rawurlencode($_FILES['attachment2']['name']); } - - if(strlen($_FILES['attachment3']['name']) > 2 ) { - $targetfile3 = "/".$student_id."/".$url."/".$lab_name."/".rawurlencode($_FILES['attachment3']['name']);} - - if(strlen($_FILES['attachment4']['name']) > 2 ) { - $targetfile4 = "/".$student_id."/".$url."/".$lab_name."/".rawurlencode($_FILES['attachment4']['name']); + + if (strlen($_FILES['attachment2']['name']) > 2) { + $targetfile2 = "/" . $student_id . "/" . $url . "/" . $lab_name . "/" . rawurlencode($_FILES['attachment2']['name']); + } + + if (strlen($_FILES['attachment3']['name']) > 2) { + $targetfile3 = "/" . $student_id . "/" . $url . "/" . $lab_name . "/" . rawurlencode($_FILES['attachment3']['name']); + } + + if (strlen($_FILES['attachment4']['name']) > 2) { + $targetfile4 = "/" . $student_id . "/" . $url . "/" . $lab_name . "/" . rawurlencode($_FILES['attachment4']['name']); } // When $group_id is not properly initialized, use integer 0 as its value. @@ -656,487 +576,368 @@ if (!empty($_POST["frm_submitlab"])) { if ($con->query($sql1) === TRUE) { } - - $sql="INSERT INTO `lab_report_submissions`(`Submission_Date`, `Lab_Report_ID`, `Student_id`," + $sql = "INSERT INTO `lab_report_submissions`(`Submission_Date`, `Lab_Report_ID`, `Student_id`," . " `Course_Group_id`, `Attachment1`, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Status`, `Title`,`Remarking_Reason`)" . " VALUES ('$date',$lab_id,$student_id,$group_id,'$targetfile','$instructions','$targetfile2','$targetfile3','$targetfile4'," . "'Pending','$title','')"; if ($con->query($sql) === TRUE) { - if($_SESSION['Sub_Type']=='Individual') - { + if ($_SESSION['Sub_Type'] == 'Individual') { $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."; - header("Location: Course.php?url=".$url); + $_SESSION["info_courses"] = "Thanks. Your lab report assignment is submitted successfully."; + header("Location: Course.php?url=" . $url); } else { echo "Error: <br>" . $con->error; } } - // JOIN COURSE if (!empty($_GET["JoinCourse"])) { - + $id = $_GET["id"]; $student_id = $_GET["std"]; $joining = $_GET["joining"]; $status = "Pending"; - - if($joining == 0){ $status = "Joined";} - - $sql="INSERT INTO `course_students_table`(`Course_ID`, `Student_ID`,`Status`) VALUES ('$id','$student_id','$status')"; - + + if ($joining == 0) { + $status = "Joined"; + } + + $sql = "INSERT INTO `course_students_table`(`Course_ID`, `Student_ID`,`Status`) VALUES ('$id','$student_id','$status')"; + if ($con->query($sql) === TRUE) { - - if($joining==0) - { + + if ($joining == 0) { $_SESSION["info_Courses_student"] = "You enrolled in this course successfully."; - } - else { + } else { $_SESSION["info_Courses_student"] = "Course enrollment request was sent to the lecturer."; } - - - header("Location: Courses.php"); - + + header("Location: Courses.php"); } else { echo "Error: " . $sql . "<br>" . $con->error; } - } - - - - #MARK LAB REPORT - + if (!empty($_GET["savemarks"])) { - - $id=$_GET["id"]; - $marks=$_GET["marks"]; - $total=$_GET["total"]; - $feedback=$_GET["feedback"]; - $header=$_GET["header"]; - $labid=$_GET["labid"]; - $status="Marked"; - - if($marks>$total) - { + + $id = $_GET["id"]; + $marks = $_GET["marks"]; + $total = $_GET["total"]; + $feedback = $_GET["feedback"]; + $header = $_GET["header"]; + $labid = $_GET["labid"]; + $status = "Marked"; + + if ($marks > $total) { echo " Marks could not be greater than total"; return; } - $date= date("Y-m-d H:i:s"); - $feedback="<br>@$date : ".$feedback; - - $sql="UPDATE `lab_report_submissions` SET `Marks`='$marks',`Status`='$status'," + $date = date("Y-m-d H:i:s"); + $feedback = "<br>@$date : " . $feedback; + + $sql = "UPDATE `lab_report_submissions` SET `Marks`='$marks',`Status`='$status'," . "" . "Notes=if(Notes is null, ' ', concat(Notes, '$feedback'))" . "" . " WHERE Submission_ID=$id "; - + if ($con->query($sql) === TRUE) { - - - $_SESSION["info_Marking"]="Lab Report Submission Marked"; - header("Location: Submissions.php?id=".$labid."&header=".$header."&total=".$total); - - + + $_SESSION["info_Marking"] = "Lab Report Submission Marked"; + header("Location: Submissions.php?id=" . $labid . "&header=" . $header . "&total=" . $total); } else { echo "Error: " . $sql . "<br>" . $con->error; } - } - - - - #Update Report Visibility if (!empty($_GET["updatevisibility"])) { - - $id=$_GET["id"]; - $marks=$_GET["marks"]; - $total=$_GET["total"]; - $status=$_GET["status"]; - $header=$_GET["header"]; - $labid=$_GET["labid"]; - - - - $sql="UPDATE `lab_report_submissions` SET `Visibility`='$status' WHERE Submission_ID=$id + + $id = $_GET["id"]; + $marks = $_GET["marks"]; + $total = $_GET["total"]; + $status = $_GET["status"]; + $header = $_GET["header"]; + $labid = $_GET["labid"]; + + $sql = "UPDATE `lab_report_submissions` SET `Visibility`='$status' WHERE Submission_ID=$id "; - + if ($con->query($sql) === TRUE) { - - $_SESSION["info_Marking"]="Lab Report Visibility Updated"; - header("Location: Submissions.php?id=".$labid."&header=".$header."&total=".$total); - - + + $_SESSION["info_Marking"] = "Lab Report Visibility Updated"; + header("Location: Submissions.php?id=" . $labid . "&header=" . $header . "&total=" . $total); } else { echo "Error: " . $sql . "<br>" . $con->error; } - } - - - - #Remarking Request - + if (!empty($_GET["remarking"])) { - - $id=$_GET["id"]; - $url=$_GET["url"]; - - $status= $_GET["status"]; - $details=$_GET["details"]; - - $sql="UPDATE `lab_report_submissions` SET `Status`='Remarking',Remarking_Reason='$details' WHERE Submission_ID=$id + + $id = $_GET["id"]; + $url = $_GET["url"]; + + $status = $_GET["status"]; + $details = $_GET["details"]; + + $sql = "UPDATE `lab_report_submissions` SET `Status`='Remarking',Remarking_Reason='$details' WHERE Submission_ID=$id "; - + if ($con->query($sql) === TRUE) { - - - $_SESSION["info_ReMarking"]="Remarking Request Sent"; - header("Location: Course.php?url=".$url); - - + + $_SESSION["info_ReMarking"] = "Remarking Request Sent"; + header("Location: Course.php?url=" . $url); } else { echo "Error: " . $sql . "<br>" . $con->error; } - } - - - - #Create Group Request - + if (!empty($_GET["creategroup"])) { - - $student_id=$_GET["student_id"]; - $url=$_GET["url"]; - $id=$_GET["id"]; - $name= $_GET["name"]; - - - $sql="INSERT INTO `course_groups_table`(`Group_Name`, + + $student_id = $_GET["student_id"]; + $url = $_GET["url"]; + $id = $_GET["id"]; + $name = $_GET["name"]; + + $sql = "INSERT INTO `course_groups_table`(`Group_Name`, `Group_Leader`, `Course_id`) VALUES ('$name',$student_id,$id)"; - - - + if ($con->query($sql) === TRUE) { - - - $resultx1 = mysqli_query($con,"Select Max(Course_Group_id) as cnt from course_groups_table"); - while($row = mysqli_fetch_assoc($resultx1)) {$gid=$row['cnt'];} - - - $sql="INSERT INTO `course_group_members_table`( `Course_Group_id`, `Student_ID`, `Status`) + + $resultx1 = mysqli_query($con, "Select Max(Course_Group_id) as cnt from course_groups_table"); + while ($row = mysqli_fetch_assoc($resultx1)) { + $gid = $row['cnt']; + } + + $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"; - header("Location: Course.php?url=".$url); + $_SESSION["info_ReMarking"] = "Course group Created"; + header("Location: Course.php?url=" . $url); } else { echo "Error: " . $sql . "<br>" . $con->error; } - - } else { echo "Error: " . $sql . "<br>" . $con->error; } - -} - - - - +} //---------------------------------------Invite Group Request and add a new member into the database------------------------------------ - -if (!empty($_GET["groupinvite"])) { - - $student_id=$_GET["student_id"]; - $url=$_GET["url"]; - $courseid=$_GET["courseid"]; - $groupid=$_GET["groupid"]; - - $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"; - header("Location: Course.php?url=".$url); - }else{ - $sql="INSERT INTO `course_group_members_table`( `Course_Group_id`, `Student_ID`, `Status`) +if (!empty($_GET["groupinvite"])) { + + $student_id = $_GET["student_id"]; + $url = $_GET["url"]; + $courseid = $_GET["courseid"]; + $groupid = $_GET["groupid"]; + + $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"; + 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')"; } - - + if ($con->query($sql) === TRUE) { - $resultx1 = mysqli_query($con,"SELECT * FROM course_groups_table where Course_Group_id ='$groupid'"); - - while($row = mysqli_fetch_assoc($resultx1)) - { - $Group_Member=$row['Group_Member']; - $Group_Member4=$row['Group_Member4']; - $Group_Member2=$row['Group_Member2']; - $Group_Member3=$row['Group_Member3']; - $_SESSION['Group_Member4']=$Group_Member4; - $_SESSION['Group_Member3']=$Group_Member3; - $_SESSION['Group_Member2']=$Group_Member2; - $_SESSION['Group_Member']=$Group_Member; - - 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"; - 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"; - 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"; - 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"; - header("Location: Course.php?url=".$url); - } else { - $_SESSION["info_ReMarking"]= " You cant add any more members"; - header("Location: Course.php?url=".$url); - - } + $resultx1 = mysqli_query($con, "SELECT * FROM course_groups_table where Course_Group_id ='$groupid'"); + + while ($row = mysqli_fetch_assoc($resultx1)) { + $Group_Member = $row['Group_Member']; + $Group_Member4 = $row['Group_Member4']; + $Group_Member2 = $row['Group_Member2']; + $Group_Member3 = $row['Group_Member3']; + $_SESSION['Group_Member4'] = $Group_Member4; + $_SESSION['Group_Member3'] = $Group_Member3; + $_SESSION['Group_Member2'] = $Group_Member2; + $_SESSION['Group_Member'] = $Group_Member; + + 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"; + 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"; + 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"; + 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"; + header("Location: Course.php?url=" . $url); + } else { + $_SESSION["info_ReMarking"] = " You cant add any more members"; + header("Location: Course.php?url=" . $url); } - $_SESSION["info_ReMarking"]=$student_id . " was invited to the group"; - header("Location: Course.php?url=".$url); + } + $_SESSION["info_ReMarking"] = $student_id . " was invited to the group"; + header("Location: Course.php?url=" . $url); } else { echo "Error: " . $sql . "<br>" . $con->error; } } - #Accept deny Group Invite - + if (!empty($_GET["acceptinvite"])) { - - $student_id=$_GET["student_id"]; - $url=$_GET["url"]; - $action=$_GET["action"]; - $groupid=$_GET["groupid"]; - - if($action==1) - { - $sql="Update `course_group_members_table` set Status='Joined' where Course_Group_id =$groupid and student_id=$student_id - "; + + $student_id = $_GET["student_id"]; + $url = $_GET["url"]; + $action = $_GET["action"]; + $groupid = $_GET["groupid"]; + + if ($action == 1) { + $sql = "Update `course_group_members_table` set Status='Joined' where Course_Group_id =$groupid and student_id=$student_id + "; + } else { + $sql = "Delete from `course_group_members_table` where Course_Group_id =$groupid and student_id=$student_id + "; } - else - { - $sql="Delete from `course_group_members_table` where Course_Group_id =$groupid and student_id=$student_id - "; - } - + if ($con->query($sql) === TRUE) { - $_SESSION["info_ReMarking"]=" Group Invite Updated"; - header("Location: Course.php?url=".$url); + $_SESSION["info_ReMarking"] = " Group Invite Updated"; + header("Location: Course.php?url=" . $url); } else { echo "Error: " . $sql . "<br>" . $con->error; } - } - - - - #Extend Deadline - + if (!empty($_GET["extenddeadline"])) { - - $id=$_GET["id"]; - $date=$_GET["date"]; - $time=$_GET["time"]; - $type=$_GET["type"]; - - $stdid=$_GET["stdid"]; - $reason =$_GET["reason"]; - $url =$_GET["url"]; - $deadline=$date." ".$time; - - - if($type==1) - { - $sql="UPDATE `lab_reports_table` SET `Deadline`='$deadline' WHERE Lab_Report_ID=$id"; - - } - else - { - $sql="INSERT INTO `extended_deadlines_table`(`Student_ID`, " + + $id = $_GET["id"]; + $date = $_GET["date"]; + $time = $_GET["time"]; + $type = $_GET["type"]; + + $stdid = $_GET["stdid"]; + $reason = $_GET["reason"]; + $url = $_GET["url"]; + $deadline = $date . " " . $time; + + if ($type == 1) { + $sql = "UPDATE `lab_reports_table` SET `Deadline`='$deadline' WHERE Lab_Report_ID=$id"; + } else { + $sql = "INSERT INTO `extended_deadlines_table`(`Student_ID`, " . "`Lab_Report_ID`, `Extended_Deadline_Date`," . " `ReasonsForExtension`) VALUES ($stdid,$id,'$deadline','$reason')"; - } - - + if ($con->query($sql) === TRUE) { - - - $_SESSION["info_courses"]=" Lab Report Deadline extended successfully."; - header("Location: Courses.php?course=".$url); - + + $_SESSION["info_courses"] = " Lab Report Deadline extended successfully."; + header("Location: Courses.php?course=" . $url); } else { echo "Error: " . $sql . "<br>" . $con->error; } - } - - - - #IGNORE Remarking Request - -if (!empty($_GET["ignoreremarking"])) { - - - $id=$_GET["id"]; - $total=$_GET["total"]; - $header=$_GET["header"]; - - $subid=$_GET["subid"]; - - - $sql="UPDATE lab_report_submissions SET Status='Marked' WHERE Submission_ID=$subid"; - - - - if ($con->query($sql) === TRUE) { - - - - $_SESSION["info_Marking"]="Remarking Request Ignored , Submission Updated to 'Marked' status"; - header("Location: Submissions.php?id=".$id."&header=".$header."&total=".$total); - +if (!empty($_GET["ignoreremarking"])) { + + $id = $_GET["id"]; + $total = $_GET["total"]; + $header = $_GET["header"]; + + $subid = $_GET["subid"]; + + $sql = "UPDATE lab_report_submissions SET Status='Marked' WHERE Submission_ID=$subid"; + + if ($con->query($sql) === TRUE) { + + $_SESSION["info_Marking"] = "Remarking Request Ignored , Submission Updated to 'Marked' status"; + header("Location: Submissions.php?id=" . $id . "&header=" . $header . "&total=" . $total); } else { echo "Error: " . $sql . "<br>" . $con->error; } - } - - - - #Assign TA - -if (!empty($_GET["assignTA"])) { - - - $id=$_GET["id"]; - $ta=$_GET["ta"]; - - - $sql="INSERT INTO `course_ta`(`Course_ID`, `TA`) VALUES ($id,$ta)"; - - - - if ($con->query($sql) === TRUE) { - - - $_SESSION["info_Admin_Courses"]=$type." Course TA Assigned "; - header("Location: Admin.php"); - - - +if (!empty($_GET["assignTA"])) { + + $id = $_GET["id"]; + $ta = $_GET["ta"]; + + $sql = "INSERT INTO `course_ta`(`Course_ID`, `TA`) VALUES ($id,$ta)"; + + if ($con->query($sql) === TRUE) { + + $_SESSION["info_Admin_Courses"] = $type . " Course TA Assigned "; + header("Location: Admin.php"); } else { echo "Error: " . $sql . "<br>" . $con->error; } - } - - - - //ACCEPT STUDNTS JOINING COURSSS - + if (!empty($_GET["AcceptStudent"])) { - - $id=$_GET["id"]; - $rs=$_GET["rs"]; - - if($rs=="yes") - { - $sql="Update course_students_table set Status='Joined' Where ID=$id"; - - + + $id = $_GET["id"]; + $rs = $_GET["rs"]; + + if ($rs == "yes") { + $sql = "Update course_students_table set Status='Joined' Where ID=$id"; } else { - $sql="Delete FROM course_students_table Where ID=$id"; + $sql = "Delete FROM course_students_table Where ID=$id"; } - + if ($con->query($sql) === TRUE) { - - - if($rs=="yes") - { - $_SESSION["info_courses"]="Course Joining request Approved."; + + if ($rs == "yes") { + $_SESSION["info_courses"] = "Course Joining request Approved."; + } else { + $_SESSION["info_courses"] = "Course Joining request Declined & Removed."; } - else { - $_SESSION["info_courses"]="Course Joining request Declined & Removed."; - } - - header("Location: Courses.php"); - - } - else { + + header("Location: Courses.php"); + } else { echo "Error: " . $sql . "<br>" . $con->error; } - } - - - - //action=passchange&uid=1&pass=1929 - -if (!empty($_GET["action"])) { - - $action=$_GET["action"]; - $uid=$_GET["uid"]; - +if (!empty($_GET["action"])) { + + $action = $_GET["action"]; + $uid = $_GET["uid"]; + $pass = $_GET["pass"]; $pass = password_hash($pass, PASSWORD_DEFAULT); - - $status=$_GET["status"]; - + $status = $_GET["status"]; // validate uid if (intval($uid) < 0) { header("Location: index.php"); - return; + return; } - - if($action=="passchange") - { - $sql= "UPDATE users_table set Password='$pass' where User_ID=$uid;"; + if ($action == "passchange") { + $sql = "UPDATE users_table set Password='$pass' where User_ID=$uid;"; if ($con->query($sql) === TRUE) { error_reporting(0); echo "Password has been changed"; // return; - $_SESSION["infoChangePassword"]=$type." User password was changed successfully."; + $_SESSION["infoChangePassword"] = $type . " User password was changed successfully."; header("Location: index.php"); } else { // echo "Error: " . $sql . "<br>" . $con->error; @@ -1144,47 +945,38 @@ if (!empty($_GET["action"])) { } } - - if($action=="statuschange") - { - $sql= "UPDATE users_table set Status='$status' where User_ID=$uid;"; + if ($action == "statuschange") { + $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 "; + $_SESSION["info_Admin_Users"] = $type . " user Status updated successfully "; header("Location: Admin.php"); } else { // echo "Error: " . $sql . "<br>" . $con->error; - echo "Something really bad happened while changing status. Contact lanhui at zjnu.edu.cn. Thanks!"; - } + echo "Something really bad happened while changing status. Contact lanhui at zjnu.edu.cn. Thanks!"; + } } } - - - - // ############################### CREATE STUDENT USER ################################## if (!empty($_POST["frm_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"]); - $ta=mysqli_real_escape_string($con,$_POST["ta"]); - $faculty=mysqli_real_escape_string($con,$_POST["faculty"]); - $code=mysqli_real_escape_string($con,$_POST["code"]); - $url=mysqli_real_escape_string($con,$_POST["url"]); - $verify=mysqli_real_escape_string($con,$_POST["verify"]); - $who=mysqli_real_escape_string($con,$_POST["l"]); - - if($url=="") - { - $url= $code.$academic; + $name = mysqli_real_escape_string($con, $_POST["name"]); + $academic = mysqli_real_escape_string($con, $_POST["academic"]); + $lecturer = mysqli_real_escape_string($con, $_POST["lecturer"]); + $ta = mysqli_real_escape_string($con, $_POST["ta"]); + $faculty = mysqli_real_escape_string($con, $_POST["faculty"]); + $code = mysqli_real_escape_string($con, $_POST["code"]); + $url = mysqli_real_escape_string($con, $_POST["url"]); + $verify = mysqli_real_escape_string($con, $_POST["verify"]); + $who = mysqli_real_escape_string($con, $_POST["l"]); + + if ($url == "") { + $url = $code . $academic; } - - - if($ta=="") - { - $ta=0; + + if ($ta == "") { + $ta = 0; } - + // check if email is taked // $result = mysqli_query($con, // "SELECT * FROM courses_table WHERE Course_Name='$name'"); @@ -1194,42 +986,31 @@ if (!empty($_POST["frm_createCourse"])) { // header("Location: Admin.php"); // } // - - $sql="INSERT INTO `courses_table`(`Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members`) + + $sql = "INSERT INTO `courses_table`(`Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members`) VALUES ('$name','$academic','$faculty','$lecturer','$ta','$code','$url','$verify')"; - - + if ($con->query($sql) === TRUE) { - $_SESSION["info_Admin_Courses"]="Course portal was Created successfully."; - if($who=="l") - { - header("Location: Courses.php"); - } else - { - header("Location: Admin.php"); + $_SESSION["info_Admin_Courses"] = "Course portal was Created successfully."; + if ($who == "l") { + header("Location: Courses.php"); + } else { + header("Location: Admin.php"); } - - } else { echo "Error: " . $sql . "<br>" . $con->error; } } - - - - // Export grade - + if (!empty($_GET["exportgrade"])) { - - $lab=$_GET["lab"]; - $lab_name=$_GET["lab_name"]; - - - + + $lab = $_GET["lab"]; + $lab_name = $_GET["lab_name"]; + error_reporting(0); - + $select = "SELECT lab_reports_table.Title as 'LAB_Report', lab_reports_table.Marks as Lab_Marks, `Submission_Date`, lab_report_submissions.Student_id, users_table.Full_Name as Student_Name, lab_report_submissions.Marks,`Notes` FROM `lab_report_submissions` @@ -1238,46 +1019,33 @@ INNER JOIN lab_reports_table on lab_reports_table.Lab_Report_ID=lab_report_submi INNER JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id - WHERE lab_report_submissions.Lab_Report_ID=$lab"; + $export = mysqli_query($con, $select); - $export = mysqli_query($con,$select); - - - - $fields = mysqli_num_fields ( $export ); + $fields = mysqli_num_fields($export); - - for ( $i = 0; $i < $fields; $i++ ) - { - $header .= mysqli_fetch_field_direct( $export , $i )->name. "\t"; + for ($i = 0; $i < $fields; $i++) { + $header .= mysqli_fetch_field_direct($export, $i)->name . "\t"; } - - while( $row = mysqli_fetch_row( $export ) ) - { + while ($row = mysqli_fetch_row($export)) { $line = ''; - foreach( $row as $value ) - { - if ( ( !isset( $value ) ) || ( $value == "" ) ) - { + foreach ($row as $value) { + if ((!isset($value)) || ($value == "")) { $value = "\t"; - } - else - { - $value = str_replace( '"' , '""' , $value ); + } else { + $value = str_replace('"', '""', $value); $value = '"' . $value . '"' . "\t"; } $line .= $value; } - $data .= trim( $line ) . "\n"; + $data .= trim($line) . "\n"; } - $data = str_replace( "\r" , "" , $data ); + $data = str_replace("\r", "", $data); - if ( $data == "" ) - { - $data = "\n(0) Records Found!\n"; + if ($data == "") { + $data = "\n(0) Records Found!\n"; } header("Content-type: application/octet-stream"); @@ -1285,5 +1053,4 @@ WHERE lab_report_submissions.Lab_Report_ID=$lab"; header("Pragma: no-cache"); header("Expires: 0"); print "$header\n$data"; - } From 2af2d2ef55d65034b499d0c488eb96d5da5a6465 Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:43:59 +0800 Subject: [PATCH 13/16] Rename Overview.html to avoid conflict with overview.html. --- homepage/{Overview.html => Overview.html.old} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename homepage/{Overview.html => Overview.html.old} (100%) diff --git a/homepage/Overview.html b/homepage/Overview.html.old similarity index 100% rename from homepage/Overview.html rename to homepage/Overview.html.old From 7b76dd89f210b929254bfc0333ba77d7b1d2aade Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:48:44 +0800 Subject: [PATCH 14/16] xxx --- homepage/overview.html | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/homepage/overview.html b/homepage/overview.html index 2312fb3..7c39cc8 100644 --- a/homepage/overview.html +++ b/homepage/overview.html @@ -48,7 +48,7 @@ </ul> -<h3>About us</h3> +<h3>Contact</h3> <ul> <li><a href="contact.html">Contact us</a></li> @@ -67,13 +67,14 @@ <div class="tabsLeft"> <ul> <ul> - <li class="menubox"><a href="index.html" class="menubox" >Home</a></li> - <li ><a href="overview.html" class="active">Overview</a></li> - <li ><a href="features.html" class="menubox">Features</a></li> + <li class="menubox"><a href="index.html" class="menubox">Home</a></li> + <li><a href="overview.html" class="active">Overview</a></li> + <li><a href="features.html" class="menubox">Features</a></li> <li><a href="screenshots.html" class="menubox">Screenshots</a></li> <li><a href="sourcecode.html" class="menubox">Source Code</a></li> - <li><a href="issues.html" class="menubox">Issues</a></li> - <li ><a href="contact.html" class="menubox">Contact us</a></li> + <li><a href="issues.html" class="menubox">Issues</a></li> + <li><a href="contact.html" class="menubox">Contact us</a></li> + </ul> </ul> @@ -85,24 +86,24 @@ <h2>Overview</h2> - LRRS is an open-source lab report management software for college students. + LRRS is an open source lab report management software for college students. <br> - The lab report repository system is developing for general purpose and used to replace old - paperwork and email based systems . This system increases the efficiency of lab report + The lab report repository system was developed for general purposes and used to replace old + paperwork and email-based systems . This system increases the efficiency of lab report submission and result reporting for both lecturers and students. <br><br> - The Project was developed at ZJNU by Mohamed nor and El-mahdi houzi. + The project was developed at ZJNU by Mohamed nor and El-mahdi houzi. - The project was tested by some undergraduates classes at ZJNU. + The project was tested by some undergraduate students at the Zhejiang Normal University. <br> The system is developed using client/server architecture and its compatible with both Linux and Microsoft Windows Operating Systems. The system was developed using PHP Scripting language and MySQL as database management system. - <br> The LRRS project have seen incredible improvements since it's development earlier 2019. + <br> The LRRS project has seen incredible improvements since it's development earlier 2019. The software includes a lot of features that simplify assignment submission and grading. @@ -110,9 +111,15 @@ - For helpful hints about how to get the most out of this project, see <a href="quickstart.html"> Quick Start</a>. + For helpful hints about how to get the most out of this project, see <a href="quickstart.html"> Quick Start </a> Section. + + + + + + </div> <div class="pagefooter"> <div class="footerlinks"> From 034705c879bb4209e1c3ff3ebd804b499c8940e1 Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:50:23 +0800 Subject: [PATCH 15/16] delete overview.html --- homepage/Overview.html.old | 141 ------------------------------------- homepage/overview.html | 141 ------------------------------------- 2 files changed, 282 deletions(-) delete mode 100644 homepage/Overview.html.old delete mode 100644 homepage/overview.html diff --git a/homepage/Overview.html.old b/homepage/Overview.html.old deleted file mode 100644 index 7c39cc8..0000000 --- a/homepage/Overview.html.old +++ /dev/null @@ -1,141 +0,0 @@ -<!doctype html> -<html class="no-js" lang="en"> - <head> - <meta charset="utf-8"> - <meta http-equiv="x-ua-compatible" content="ie=edge"> - <title>LRRS Home Page</title> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width, initial-scale=1"> - - - <!-- Place favicon.ico in the root directory --> - <link rel="stylesheet" href="style.css"> - - </head> - <body style="padding-left:80px;padding-right:80px;"> - - - <div class="wrapAll clearfix"> - <div class="sidebar"> - <div class="logo"> - <a href="http://118.25.96.118/nor"><img src='logo_text.png' alt="LRR Logo"></a> - </div> - <div class="navigation"> - <ul> - <li><a href="index.html">Home</a></li> - - </ul> - <h3>About LRRS</h3> - <ul> - <li><a href="Overview.html">» <b>Overview</b></a></li> - <li><a href="quickstart.html">Quick Start</a></li> - <li><a href="features.html">Features</a></li> - <li><a href="screenshots.html">Screenshots</a></li> - <li><a href="DevelopmentPlan.html">Development Plan</a></li> - </ul> - <h3>Getting LRRS</h3> - <ul> - <li><a href="sourcecode.html">Source Download</a></li> - <li><a href="installation.html">Installation Guide</a></li> - <li><a href="license.html">License</a></li> - </ul> - <h3>Community</h3> - <ul> - <li><a href="mailing.html">Mailing Lists</a></li> - <li><a href="issues.html">Report Issues</a></li> - - </ul> - - -</ul> -<h3>Contact</h3> -<ul> - - <li><a href="contact.html">Contact us</a></li> - -</ul> -</div> -</div> - - -</div> -<div class="mainsection"> - <div class="headerLinks"> - This page was last edited on 14 December 2019 by Hui - </div> - <div class="tabs clearfix"> - <div class="tabsLeft"> - <ul> - <ul> - <li class="menubox"><a href="index.html" class="menubox">Home</a></li> - <li><a href="overview.html" class="active">Overview</a></li> - <li><a href="features.html" class="menubox">Features</a></li> - <li><a href="screenshots.html" class="menubox">Screenshots</a></li> - <li><a href="sourcecode.html" class="menubox">Source Code</a></li> - <li><a href="issues.html" class="menubox">Issues</a></li> - <li><a href="contact.html" class="menubox">Contact us</a></li> - - </ul> - - </ul> - </div> - - - </div> - <div class="article"> - <h2>Overview</h2> - - - LRRS is an open source lab report management software for college students. - - - <br> - The lab report repository system was developed for general purposes and used to replace old - paperwork and email-based systems . This system increases the efficiency of lab report - submission and result reporting for both lecturers and students. - <br><br> - - - The project was developed at ZJNU by Mohamed nor and El-mahdi houzi. - - The project was tested by some undergraduate students at the Zhejiang Normal University. - <br> The system is developed using client/server architecture and its compatible with both Linux and Microsoft Windows Operating Systems. The system was developed using PHP Scripting language and MySQL as database management system. - - - - <br> The LRRS project has seen incredible improvements since it's development earlier 2019. - The software includes a lot of features that simplify assignment submission and grading. - - - we invite you to participate in the development of LRRS. - - - - For helpful hints about how to get the most out of this project, see <a href="quickstart.html"> Quick Start </a> Section. - - - - - - - - - </div> - <div class="pagefooter"> - <div class="footerlinks"> - </div> - </div> - - -</div> -</div> - - - - -</body> - -</html> - - - diff --git a/homepage/overview.html b/homepage/overview.html deleted file mode 100644 index 7c39cc8..0000000 --- a/homepage/overview.html +++ /dev/null @@ -1,141 +0,0 @@ -<!doctype html> -<html class="no-js" lang="en"> - <head> - <meta charset="utf-8"> - <meta http-equiv="x-ua-compatible" content="ie=edge"> - <title>LRRS Home Page</title> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width, initial-scale=1"> - - - <!-- Place favicon.ico in the root directory --> - <link rel="stylesheet" href="style.css"> - - </head> - <body style="padding-left:80px;padding-right:80px;"> - - - <div class="wrapAll clearfix"> - <div class="sidebar"> - <div class="logo"> - <a href="http://118.25.96.118/nor"><img src='logo_text.png' alt="LRR Logo"></a> - </div> - <div class="navigation"> - <ul> - <li><a href="index.html">Home</a></li> - - </ul> - <h3>About LRRS</h3> - <ul> - <li><a href="Overview.html">» <b>Overview</b></a></li> - <li><a href="quickstart.html">Quick Start</a></li> - <li><a href="features.html">Features</a></li> - <li><a href="screenshots.html">Screenshots</a></li> - <li><a href="DevelopmentPlan.html">Development Plan</a></li> - </ul> - <h3>Getting LRRS</h3> - <ul> - <li><a href="sourcecode.html">Source Download</a></li> - <li><a href="installation.html">Installation Guide</a></li> - <li><a href="license.html">License</a></li> - </ul> - <h3>Community</h3> - <ul> - <li><a href="mailing.html">Mailing Lists</a></li> - <li><a href="issues.html">Report Issues</a></li> - - </ul> - - -</ul> -<h3>Contact</h3> -<ul> - - <li><a href="contact.html">Contact us</a></li> - -</ul> -</div> -</div> - - -</div> -<div class="mainsection"> - <div class="headerLinks"> - This page was last edited on 14 December 2019 by Hui - </div> - <div class="tabs clearfix"> - <div class="tabsLeft"> - <ul> - <ul> - <li class="menubox"><a href="index.html" class="menubox">Home</a></li> - <li><a href="overview.html" class="active">Overview</a></li> - <li><a href="features.html" class="menubox">Features</a></li> - <li><a href="screenshots.html" class="menubox">Screenshots</a></li> - <li><a href="sourcecode.html" class="menubox">Source Code</a></li> - <li><a href="issues.html" class="menubox">Issues</a></li> - <li><a href="contact.html" class="menubox">Contact us</a></li> - - </ul> - - </ul> - </div> - - - </div> - <div class="article"> - <h2>Overview</h2> - - - LRRS is an open source lab report management software for college students. - - - <br> - The lab report repository system was developed for general purposes and used to replace old - paperwork and email-based systems . This system increases the efficiency of lab report - submission and result reporting for both lecturers and students. - <br><br> - - - The project was developed at ZJNU by Mohamed nor and El-mahdi houzi. - - The project was tested by some undergraduate students at the Zhejiang Normal University. - <br> The system is developed using client/server architecture and its compatible with both Linux and Microsoft Windows Operating Systems. The system was developed using PHP Scripting language and MySQL as database management system. - - - - <br> The LRRS project has seen incredible improvements since it's development earlier 2019. - The software includes a lot of features that simplify assignment submission and grading. - - - we invite you to participate in the development of LRRS. - - - - For helpful hints about how to get the most out of this project, see <a href="quickstart.html"> Quick Start </a> Section. - - - - - - - - - </div> - <div class="pagefooter"> - <div class="footerlinks"> - </div> - </div> - - -</div> -</div> - - - - -</body> - -</html> - - - From 534b01485449163ab81c4fc626db44c00ec0be11 Mon Sep 17 00:00:00 2001 From: Lan Hui <lanhui@zjnu.edu.cn> Date: Mon, 18 Oct 2021 23:54:12 +0800 Subject: [PATCH 16/16] update .gitignore and add homepage/Overview.html back. --- .gitignore | 2 +- homepage/Overview.html | 141 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 homepage/Overview.html diff --git a/.gitignore b/.gitignore index c1ea37f..faa1838 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ .vscode -homepage/Overview.html + diff --git a/homepage/Overview.html b/homepage/Overview.html new file mode 100644 index 0000000..7c39cc8 --- /dev/null +++ b/homepage/Overview.html @@ -0,0 +1,141 @@ +<!doctype html> +<html class="no-js" lang="en"> + <head> + <meta charset="utf-8"> + <meta http-equiv="x-ua-compatible" content="ie=edge"> + <title>LRRS Home Page</title> + <meta name="description" content=""> + <meta name="viewport" content="width=device-width, initial-scale=1"> + + + <!-- Place favicon.ico in the root directory --> + <link rel="stylesheet" href="style.css"> + + </head> + <body style="padding-left:80px;padding-right:80px;"> + + + <div class="wrapAll clearfix"> + <div class="sidebar"> + <div class="logo"> + <a href="http://118.25.96.118/nor"><img src='logo_text.png' alt="LRR Logo"></a> + </div> + <div class="navigation"> + <ul> + <li><a href="index.html">Home</a></li> + + </ul> + <h3>About LRRS</h3> + <ul> + <li><a href="Overview.html">» <b>Overview</b></a></li> + <li><a href="quickstart.html">Quick Start</a></li> + <li><a href="features.html">Features</a></li> + <li><a href="screenshots.html">Screenshots</a></li> + <li><a href="DevelopmentPlan.html">Development Plan</a></li> + </ul> + <h3>Getting LRRS</h3> + <ul> + <li><a href="sourcecode.html">Source Download</a></li> + <li><a href="installation.html">Installation Guide</a></li> + <li><a href="license.html">License</a></li> + </ul> + <h3>Community</h3> + <ul> + <li><a href="mailing.html">Mailing Lists</a></li> + <li><a href="issues.html">Report Issues</a></li> + + </ul> + + +</ul> +<h3>Contact</h3> +<ul> + + <li><a href="contact.html">Contact us</a></li> + +</ul> +</div> +</div> + + +</div> +<div class="mainsection"> + <div class="headerLinks"> + This page was last edited on 14 December 2019 by Hui + </div> + <div class="tabs clearfix"> + <div class="tabsLeft"> + <ul> + <ul> + <li class="menubox"><a href="index.html" class="menubox">Home</a></li> + <li><a href="overview.html" class="active">Overview</a></li> + <li><a href="features.html" class="menubox">Features</a></li> + <li><a href="screenshots.html" class="menubox">Screenshots</a></li> + <li><a href="sourcecode.html" class="menubox">Source Code</a></li> + <li><a href="issues.html" class="menubox">Issues</a></li> + <li><a href="contact.html" class="menubox">Contact us</a></li> + + </ul> + + </ul> + </div> + + + </div> + <div class="article"> + <h2>Overview</h2> + + + LRRS is an open source lab report management software for college students. + + + <br> + The lab report repository system was developed for general purposes and used to replace old + paperwork and email-based systems . This system increases the efficiency of lab report + submission and result reporting for both lecturers and students. + <br><br> + + + The project was developed at ZJNU by Mohamed nor and El-mahdi houzi. + + The project was tested by some undergraduate students at the Zhejiang Normal University. + <br> The system is developed using client/server architecture and its compatible with both Linux and Microsoft Windows Operating Systems. The system was developed using PHP Scripting language and MySQL as database management system. + + + + <br> The LRRS project has seen incredible improvements since it's development earlier 2019. + The software includes a lot of features that simplify assignment submission and grading. + + + we invite you to participate in the development of LRRS. + + + + For helpful hints about how to get the most out of this project, see <a href="quickstart.html"> Quick Start </a> Section. + + + + + + + + + </div> + <div class="pagefooter"> + <div class="footerlinks"> + </div> + </div> + + +</div> +</div> + + + + +</body> + +</html> + + +