Merge pull request #69 from lanlab-org/Hui-IncorporateChangesMadeByEnock
Hui incorporate changes made by EnockSIMPLICITY_Bug-189_Course_Delete_btn
commit
95e3e92a60
|
@ -34,7 +34,7 @@ if (mysqli_connect_errno()) {
|
|||
<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;"> LRRS</a>
|
||||
<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>
|
||||
|
|
40
Script.php
40
Script.php
|
@ -41,7 +41,6 @@ function is_valid_student_number($student_id) {
|
|||
if (!empty($_POST["frm_signup_1"])) {
|
||||
|
||||
$student_id = trim( mysqli_real_escape_string($con, $_POST["student_id"]) );
|
||||
$passport = trim( mysqli_real_escape_string($con, $_POST["passport"]) );
|
||||
|
||||
// validate student number
|
||||
if (! is_valid_student_number($student_id)) {
|
||||
|
@ -50,14 +49,6 @@ if (!empty($_POST["frm_signup_1"])) {
|
|||
return;
|
||||
}
|
||||
|
||||
// passport should be empty (not used)
|
||||
if (strcmp($passport, '') != 0) {
|
||||
$_SESSION["info_signup1"] = "Passport is disused. Please leave it empty.";
|
||||
header("Location: index.php");
|
||||
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)
|
||||
|
@ -71,7 +62,6 @@ if (!empty($_POST["frm_signup_1"])) {
|
|||
if(mysqli_num_rows($result98) == 0)
|
||||
{
|
||||
$_SESSION['user_student_id'] = $student_id;
|
||||
$_SESSION['user_passport'] = $passport;
|
||||
header("Location: signup.php");
|
||||
return;
|
||||
}
|
||||
|
@ -84,17 +74,13 @@ if (!empty($_POST["frm_signup_1"])) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ############################### 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"]);
|
||||
$email = mysqli_real_escape_string($con, $_POST["email"]);
|
||||
$password = mysqli_real_escape_string($con, $_POST["password"]);
|
||||
$confirmpassword = mysqli_real_escape_string($con, $_POST["confirmpassword"]);
|
||||
$student_id = $_SESSION['user_student_id'];
|
||||
$passport = $_SESSION['user_passport'];
|
||||
$_SESSION['user_fullname'] = $fullname;
|
||||
$_SESSION['user_type'] = "Student";
|
||||
$_SESSION['user_email'] = $email;
|
||||
|
@ -139,13 +125,12 @@ if (!empty($_POST["frm_signup_2"])) {
|
|||
|
||||
// apply password_hash()
|
||||
$password_hash = password_hash($password, PASSWORD_DEFAULT);
|
||||
$sql= "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`, `Student_ID`, `Passport_Number`) VALUES "
|
||||
. "('$email','$password_hash','$fullname','Student','$student_id','$passport')";
|
||||
$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");
|
||||
} else {
|
||||
// echo "Error: " . $sql . "<br>" . $con->error;
|
||||
echo "Something really bad (SQL insertion error) happend during sign up.";
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +138,6 @@ if (!empty($_POST["frm_signup_2"])) {
|
|||
|
||||
|
||||
|
||||
|
||||
// ################################ LOGIN #####################################
|
||||
|
||||
if (!empty($_POST["frm_login"])) {
|
||||
|
@ -235,13 +219,17 @@ if (!empty($_POST["frm_recover_password"])) {
|
|||
|
||||
// validate student number
|
||||
if (strlen($student_id) != 12 || is_numeric($student_id) == FALSE) {
|
||||
echo "Invalid student number.";
|
||||
$_SESSION["info_recover_password"]="Invalid student number.";
|
||||
#echo "Invalid student number.";
|
||||
header("Location: recover_password.php");
|
||||
return;
|
||||
}
|
||||
|
||||
// validate email
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
echo "Invalid email address.";
|
||||
$_SESSION["info_recover_password"]="Invalid email address.";
|
||||
// echo "Invalid email address.";
|
||||
header("Location: recover_password.php");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -255,8 +243,7 @@ if (!empty($_POST["frm_recover_password"])) {
|
|||
} else
|
||||
{
|
||||
$result = mysqli_query($con, "DELETE FROM users_table WHERE Email='$email' and Student_ID='$student_id'");
|
||||
$_SESSION["info_recover_password"] = "<b>Reset done. Please go to the sign up page and sign up again</b>.";
|
||||
header("Location: recover_password.php");
|
||||
header("Location: signup.php");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -327,7 +314,6 @@ if (!empty($_POST["frm_reset_password"])) {
|
|||
// ############################### CREATE Lecturer/TA USER ##################################
|
||||
if (!empty($_POST["frm_createlecturrer"])) {
|
||||
$email=mysqli_real_escape_string($con,$_POST["email"]);
|
||||
$passport=mysqli_real_escape_string($con,$_POST["passport"]);
|
||||
$fullname=mysqli_real_escape_string($con,$_POST["fullname"]);
|
||||
$type=mysqli_real_escape_string($con,$_POST["type"]);
|
||||
$password=$passport;
|
||||
|
@ -339,8 +325,8 @@ if (!empty($_POST["frm_createlecturrer"])) {
|
|||
$_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`, `Passport_Number`) VALUES "
|
||||
. "('$email','$password','$fullname','$type','$passport')";
|
||||
$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.";
|
||||
|
@ -528,7 +514,7 @@ function checksize($file)
|
|||
{
|
||||
$result = $_FILES["$file"]['size']/(1024*1024);
|
||||
|
||||
if($result > 3)
|
||||
if($result > 1)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.7 MiB |
109
index.php
109
index.php
|
@ -12,38 +12,41 @@ if (isset($_SESSION["user_fullname"])) {
|
|||
?>
|
||||
|
||||
<br><br><br>
|
||||
<br><br><br>
|
||||
<div class="row" style="width:80%;margin:auto;">
|
||||
|
||||
<div class="row" style="width:85%;margin:auto;">
|
||||
<div class="col-md-4">
|
||||
<br><br>
|
||||
<img src="logo_text.png" style="width">
|
||||
<img src="logo.png" style="width:40%; position:relative; right:-95px; top:1px;">
|
||||
<br><br>
|
||||
<div style="width:20%; position:relative; right:-90px; font-family: Poppins-Regular;">
|
||||
<h1>Lab Report Repository</h1>
|
||||
<br><br>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4 list-group">
|
||||
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4 class="list-group-item active"> Sign in </h4>
|
||||
|
||||
<div style = "position:relative; left:240px; top:-2px;">
|
||||
<h4 class="list-group-item active" style="font-weight:normal;font-family: Poppins-Regular;"> Sign in </h4>
|
||||
<div class="list-group-item">
|
||||
|
||||
<div class="panel-body">
|
||||
|
||||
|
||||
<form method="post" action="Script.php" name="frm_login">
|
||||
<input type="hidden" name="frm_login" value="true"/>
|
||||
Student ID / Email
|
||||
<input type="text" name="user" placeholder="Email / Student Number" class="form-control" required="required" />
|
||||
|
||||
<br>
|
||||
Password
|
||||
<input type="password" class="form-control" name="password" placeholder="password" required="required" />
|
||||
<br>
|
||||
<input type="submit" class="btn btn-primary" value="Login"><br> <a href="recover_password.php" style="font-weight:normal;color:gray">Reset my password</a>
|
||||
|
||||
<div class="text-center">
|
||||
<br><input type="submit" class="btn-primary" value="Login">
|
||||
</div>
|
||||
<br> <a href="recover_password.php" style="font-weight:normal;color:#2471A3font-family: Poppins-Regular;
|
||||
font-size: 17px;">Reset my password</a>
|
||||
<div class="text-center">
|
||||
<br><span class="txt1">Don't have an account?</span>
|
||||
<a class="txt2" href="signup.php" style="font-weight:normal">Sign Up</a>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
|
@ -55,7 +58,7 @@ if (isset($_SESSION["user_fullname"])) {
|
|||
}
|
||||
|
||||
|
||||
// wrong password
|
||||
// wrong pass
|
||||
if(isset($_SESSION['wrong_pass'])) {
|
||||
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['wrong_pass'].'</div>';
|
||||
$_SESSION['wrong_pass']=null;
|
||||
|
@ -66,74 +69,60 @@ if (isset($_SESSION["user_fullname"])) {
|
|||
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['infoChangePassword'].'</div>';
|
||||
$_SESSION['infoChangePassword']=null;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4 list-group">
|
||||
|
||||
<br>
|
||||
<h4 class="list-group-item active"> Sign up </h4>
|
||||
<div class="list-group-item" style="height:235px">
|
||||
|
||||
<form method="post" action="Script.php" name="frm_signup_1">
|
||||
<input type="hidden" name="frm_signup_1" value="true"/>
|
||||
|
||||
Student ID
|
||||
<input type="text" name="student_id" placeholder="Entre your student ID" class="form-control" required="">
|
||||
<br>
|
||||
|
||||
<div class="btnsignup" style="padding-top:58px">
|
||||
<input type="submit" name="frm_signup_1" class="btn btn-primary" value="Next"> <br> Click Next to set up password
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
if(isset($_SESSION['info_signup1'])) {
|
||||
echo '<div class="alert alert-danger" role="alert">'.$_SESSION['info_signup1'].'</div>';
|
||||
$_SESSION['info_signup1'] = null;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div style="" id="footer">
|
||||
LRRS was originally developed as a <a href="http://lanlab.org/course/2018f/se/homepage.html" style="color:white;">software engineering course project</a> by Mohamed Nor and Elmahdi Houzi.
|
||||
Please submit your suggestions or bug reports to lanhui _at_ zjnu.edu.cn.
|
||||
Last updated on 18/04/2020 by Ashly. <a href="./homepage" style="color:white;">More information ...</a>
|
||||
LRR was originally developed as a <a href="http://lanlab.org/course/2018f/se/homepage.html" style="color:white;">software engineering course project</a> by Mohamed Nor and Elmahdi Houzi. Please submit your suggestions or bug reports to lanhui _at_ zjnu.edu.cn. Last updated on 18/04/2020 by Ashly. <a href="./homepage" style="color:white;">More information ...</a>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
<style>
|
||||
/*------------------------------------------------------------------
|
||||
[ Login Button ]*/
|
||||
.btn-primary {
|
||||
color: white;
|
||||
border-radius: 5px;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
|
||||
background: rgb(75, 184, 240);
|
||||
padding:5px 100px;
|
||||
font-family: Poppins-Regular;
|
||||
font-size: 23px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
#footer{
|
||||
position:fixed;
|
||||
bottom:0;
|
||||
left:0;
|
||||
background-color:#03417C;
|
||||
color:#e0e0e0;
|
||||
color:#FFF;
|
||||
text-align:center;
|
||||
width:100%;
|
||||
}
|
||||
.txt1 {
|
||||
font-family: Poppins-Regular;
|
||||
font-size: 18px;
|
||||
line-height: 1.5;
|
||||
color: #666666;
|
||||
}
|
||||
.txt2 {
|
||||
font-family: Poppins-Regular;
|
||||
font-size: 19px;
|
||||
line-height: 1.5;
|
||||
color: #2471A3;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -31,15 +31,9 @@ include 'Header.php';
|
|||
<br/>
|
||||
Email <input type="text" name="email" placeholder="Enter your email address" class="form-control" value="<?php echo $_SESSION['user_email']; ?>">
|
||||
<br/>
|
||||
<input type="submit" class="btn btn-primary" value="Recover">
|
||||
<br> * You will need to sign up again after you click the above button.
|
||||
<input type="submit" class="btn-primary" value="Recover">
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
@ -49,3 +43,18 @@ if(isset($_SESSION['info_recover_password'])) {
|
|||
}
|
||||
|
||||
?>
|
||||
|
||||
<style>
|
||||
/*------------------------------------------------------------------
|
||||
[ Login Button ]*/
|
||||
.btn-primary {
|
||||
color: white;
|
||||
border-radius: 5px;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
|
||||
background: rgb(75, 184, 240);
|
||||
padding:5px 102px;
|
||||
font-family: Poppins-Regular;
|
||||
font-size: 23px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
</style>
|
||||
|
|
19
signup.php
19
signup.php
|
@ -24,6 +24,9 @@ include 'Header.php';
|
|||
Full Name
|
||||
<input type="text" name="fullname" placeholder="Your Full Name" class="form-control" value="<?php echo $_SESSION['user_fullname']; ?>" required="required"/>
|
||||
|
||||
Student ID
|
||||
<input type="text" name="user_student_id" placeholder="Entre your Student ID" class="form-control" value="<?php echo $_SESSION['user_student_id']; ?>" required="required">
|
||||
|
||||
Email
|
||||
<input type="text" name="email" placeholder="Email" class="form-control" value="<?php echo $_SESSION['user_email']; ?>" required="required" />
|
||||
|
||||
|
@ -33,7 +36,7 @@ include 'Header.php';
|
|||
Confirm Password
|
||||
<input type="password" class="form-control" name="confirmpassword" placeholder="Confirm password" required="required" />
|
||||
<br>
|
||||
<input type="submit" class="btn btn-primary" value="Sign up">
|
||||
<input type="submit" class="btn-primary" value="Sign up">
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
if(isset($_SESSION['info_signup2'])) {
|
||||
|
@ -48,3 +51,17 @@ if(isset($_SESSION['info_signup2'])) {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
/*------------------------------------------------------------------
|
||||
[ Login Button ]*/
|
||||
.btn-primary {
|
||||
color: white;
|
||||
border-radius: 5px;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
|
||||
background: rgb(75, 184, 240);
|
||||
padding:5px 105px;
|
||||
font-family: Poppins-Regular;
|
||||
font-size: 23px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue