index.php: resolve merge conflicts

SIMPLICITY_link
Hui Lan 2021-04-09 14:52:08 +08:00
commit a0f82ec8a5
6 changed files with 144 additions and 142 deletions

View File

@ -34,7 +34,7 @@ if (mysqli_connect_errno()) {
<body> <body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark" style="padding-left:150px;padding-right:150px;margin:auto;"> <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"> <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> <span class="navbar-toggler-icon"></span>
</button> </button>

View File

@ -41,7 +41,6 @@ function is_valid_student_number($student_id) {
if (!empty($_POST["frm_signup_1"])) { 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"]) );
$passport = trim( mysqli_real_escape_string($con, $_POST["passport"]) );
// validate student number // validate student number
if (! is_valid_student_number($student_id)) { if (! is_valid_student_number($student_id)) {
@ -50,14 +49,6 @@ if (!empty($_POST["frm_signup_1"])) {
return; 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 // Check if this student number is a legal one
$result = mysqli_query($con, "SELECT * FROM `students_data` WHERE Student_ID='$student_id'"); $result = mysqli_query($con, "SELECT * FROM `students_data` WHERE Student_ID='$student_id'");
if(mysqli_num_rows($result) == 0) if(mysqli_num_rows($result) == 0)
@ -71,7 +62,6 @@ if (!empty($_POST["frm_signup_1"])) {
if(mysqli_num_rows($result98) == 0) if(mysqli_num_rows($result98) == 0)
{ {
$_SESSION['user_student_id'] = $student_id; $_SESSION['user_student_id'] = $student_id;
$_SESSION['user_passport'] = $passport;
header("Location: signup.php"); header("Location: signup.php");
return; return;
} }
@ -84,17 +74,13 @@ if (!empty($_POST["frm_signup_1"])) {
} }
// ############################### CREATE STUDENT USER ################################## // ############################### CREATE STUDENT USER ##################################
if (!empty($_POST["frm_signup_2"])) { if (!empty($_POST["frm_signup_2"])) {
$fullname = mysqli_real_escape_string($con, $_POST["fullname"]); $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"]); $email = mysqli_real_escape_string($con, $_POST["email"]);
$password = mysqli_real_escape_string($con, $_POST["password"]); $password = mysqli_real_escape_string($con, $_POST["password"]);
$confirmpassword = mysqli_real_escape_string($con, $_POST["confirmpassword"]); $confirmpassword = mysqli_real_escape_string($con, $_POST["confirmpassword"]);
$student_id = $_SESSION['user_student_id'];
$passport = $_SESSION['user_passport'];
$_SESSION['user_fullname'] = $fullname; $_SESSION['user_fullname'] = $fullname;
$_SESSION['user_type'] = "Student"; $_SESSION['user_type'] = "Student";
$_SESSION['user_email'] = $email; $_SESSION['user_email'] = $email;
@ -139,13 +125,12 @@ if (!empty($_POST["frm_signup_2"])) {
// apply password_hash() // apply password_hash()
$password_hash = password_hash($password, PASSWORD_DEFAULT); $password_hash = password_hash($password, PASSWORD_DEFAULT);
$sql= "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`, `Student_ID`, `Passport_Number`) VALUES " $sql= "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`, `Student_ID`) VALUES "
. "('$email','$password_hash','$fullname','Student','$student_id','$passport')"; . "('$email','$password_hash','$fullname','Student','$student_id')";
if ($con->query($sql) === TRUE) { if ($con->query($sql) === TRUE) {
header("Location: Courses.php"); header("Location: Courses.php");
} else { } else {
// echo "Error: " . $sql . "<br>" . $con->error;
echo "Something really bad (SQL insertion error) happend during sign up."; echo "Something really bad (SQL insertion error) happend during sign up.";
} }
} }
@ -153,7 +138,6 @@ if (!empty($_POST["frm_signup_2"])) {
// ################################ LOGIN ##################################### // ################################ LOGIN #####################################
if (!empty($_POST["frm_login"])) { if (!empty($_POST["frm_login"])) {
@ -235,13 +219,17 @@ if (!empty($_POST["frm_recover_password"])) {
// validate student number // validate student number
if (strlen($student_id) != 12 || is_numeric($student_id) == FALSE) { 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; return;
} }
// validate email // validate email
if (!filter_var($email, FILTER_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; return;
} }
@ -255,8 +243,7 @@ if (!empty($_POST["frm_recover_password"])) {
} else } else
{ {
$result = mysqli_query($con, "DELETE FROM users_table WHERE Email='$email' and Student_ID='$student_id'"); $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: signup.php");
header("Location: recover_password.php");
} }
} }
@ -327,7 +314,6 @@ if (!empty($_POST["frm_reset_password"])) {
// ############################### CREATE Lecturer/TA USER ################################## // ############################### CREATE Lecturer/TA USER ##################################
if (!empty($_POST["frm_createlecturrer"])) { if (!empty($_POST["frm_createlecturrer"])) {
$email=mysqli_real_escape_string($con,$_POST["email"]); $email=mysqli_real_escape_string($con,$_POST["email"]);
$passport=mysqli_real_escape_string($con,$_POST["passport"]);
$fullname=mysqli_real_escape_string($con,$_POST["fullname"]); $fullname=mysqli_real_escape_string($con,$_POST["fullname"]);
$type=mysqli_real_escape_string($con,$_POST["type"]); $type=mysqli_real_escape_string($con,$_POST["type"]);
$password=$passport; $password=$passport;
@ -339,8 +325,8 @@ if (!empty($_POST["frm_createlecturrer"])) {
$_SESSION["info_Admin_Users"]="Email adress : ".$email." is already in use."; $_SESSION["info_Admin_Users"]="Email adress : ".$email." is already in use.";
header("Location: Admin.php"); header("Location: Admin.php");
} }
$sql= "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`, `Passport_Number`) VALUES " $sql= "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`) VALUES "
. "('$email','$password','$fullname','$type','$passport')"; . "('$email','$password','$fullname','$type')";
if ($con->query($sql) === TRUE) { if ($con->query($sql) === TRUE) {
$_SESSION["info_Admin_Users"]=$type." user Created successfully : email ".$email." and $password as Password."; $_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); $result = $_FILES["$file"]['size']/(1024*1024);
if($result > 3) if($result > 1)
{ {
return FALSE; return FALSE;
} }

BIN
background.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

136
index.php
View File

@ -12,38 +12,42 @@ if (isset($_SESSION["user_fullname"])) {
?> ?>
<br><br><br> <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"> <div class="col-md-4">
<br><br> <br><br>
<img src="logo_text.png" style="width"> <img src="logo_lrr.png" style="width:40%; position:relative; right:-200px; top:1px;">
<h1> Lab Report Repository </h1>
<br><br> <br><br>
<div style="width; position:relative; right:-90px; font-family: Poppins-Regular;">
<h1>Lab Report Repository</h1>
<br><br>
</div>
</div> </div>
<div class="col-md-4 list-group">
<br> <br>
<div style = "position:relative; left:240px; top:-2px;">
<h4 class="list-group-item active"> Sign in </h4> <h4 class="list-group-item active" style="font-weight:normal;font-family: Poppins-Regular;"> Sign in </h4>
<div class="list-group-item"> <div class="list-group-item">
<div class="panel-body"> <div class="panel-body">
<form method="post" action="Script.php" name="frm_login"> <form method="post" action="Script.php" name="frm_login">
<input type="hidden" name="frm_login" value="true"/> <input type="hidden" name="frm_login" value="true"/>
Student ID / Email Student ID / Email
<input type="text" name="user" placeholder="Email / Student Number" class="form-control" required="required" /> <input type="text" name="user" placeholder="Email / Student Number" class="form-control" required="required" />
<br>
Password Password
<input type="password" class="form-control" name="password" placeholder="password" required="required" /> <input type="password" class="form-control" name="password" placeholder="password" required="required" />
<br> <div class="text-center">
<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> <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 <?php
@ -51,89 +55,75 @@ if (isset($_SESSION["user_fullname"])) {
if(isset($_SESSION['info_login'])) { if(isset($_SESSION['info_login'])) {
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['info_login'].'</div>'; echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['info_login'].'</div>';
$_SESSION['info_login'] = null; $_SESSION['info_login']=null;
} }
// wrong password // wrong pass
if(isset($_SESSION['wrong_pass'])) { if(isset($_SESSION['wrong_pass'])) {
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['wrong_pass'].'</div>'; echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['wrong_pass'].'</div>';
$_SESSION['wrong_pass'] = null; $_SESSION['wrong_pass']=null;
} }
if(isset($_SESSION['infoChangePassword'])) { if(isset($_SESSION['infoChangePassword'])) {
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['infoChangePassword'].'</div>'; echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['infoChangePassword'].'</div>';
$_SESSION['infoChangePassword'] = null; $_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> </div>
</form> </form>
</div>
</div> </div>
</div>
</div>
</div>
</div> </div>
<div style="" id="footer"> <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. 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>
Please submit your suggestions or bug reports to lanhui _at_ zjnu.edu.cn. </div>
Last updated on 18/04/2020 by Ashly. <a href="./homepage" style="color:white;">More information ...</a>
</div>
</body> </body>
<style> <style>
#footer { /*------------------------------------------------------------------
position:fixed; [ Login Button ]*/
bottom:0; .btn-primary {
left:0; color: white;
background-color:#03417C; border-radius: 5px;
color:#e0e0e0; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
text-align:center; background: rgb(75, 184, 240);
width:100%; padding:5px 162px;
font-family: Poppins-Regular;
font-size: 23px;
line-height: 1.5;
} }
#footer{
position:fixed;
bottom:0;
left:0;
background-color:#03417C;
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> </style>
</html> </html>

View File

@ -25,21 +25,15 @@ include 'Header.php';
<div class="list-group-item"> <div class="list-group-item">
<div class="panel-body"> <div class="panel-body">
<form method="post" action="Script.php" > <form method="post" action="Script.php">
<input type="hidden" name="frm_recover_password" value="true"/> <input type="hidden" name="frm_recover_password" value="true"/>
Student number <input type="text" name="sno" placeholder="Enter your student number" class="form-control" value="<?php echo $_SESSION['student_number']; ?>"> Student number <input type="text" name="sno" placeholder="Enter your student number" class="form-control" value="<?php echo $_SESSION['student_number']; ?>">
<br/> <br/>
Email <input type="text" name="email" placeholder="Enter your email address" class="form-control" value="<?php echo $_SESSION['user_email']; ?>"> Email <input type="text" name="email" placeholder="Enter your email address" class="form-control" value="<?php echo $_SESSION['user_email']; ?>">
<br/> <br/>
<input type="submit" class="btn btn-primary" value="Recover"> <input type="submit" class="btn-primary" value="Recover">
<br> * You will need to sign up again after you click the above button.
</form>
</div>
</div>
</div>
</div>
</form>
<?php <?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 195px;
font-family: Poppins-Regular;
font-size: 23px;
line-height: 1.5;
}
</style>

View File

@ -24,6 +24,9 @@ include 'Header.php';
Full Name Full Name
<input type="text" name="fullname" placeholder="Your Full Name" class="form-control" value="<?php echo $_SESSION['user_fullname']; ?>" required="required"/> <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 Email
<input type="text" name="email" placeholder="Email" class="form-control" value="<?php echo $_SESSION['user_email']; ?>" required="required" /> <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 Confirm Password
<input type="password" class="form-control" name="confirmpassword" placeholder="Confirm password" required="required" /> <input type="password" class="form-control" name="confirmpassword" placeholder="Confirm password" required="required" />
<br> <br>
<input type="submit" class="btn btn-primary" value="Sign up"> <input type="submit" class="btn-primary" value="Sign up">
<?php <?php
error_reporting(E_ALL); error_reporting(E_ALL);
if(isset($_SESSION['info_signup2'])) { if(isset($_SESSION['info_signup2'])) {
@ -48,3 +51,17 @@ if(isset($_SESSION['info_signup2'])) {
</div> </div>
</div> </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 195px;
font-family: Poppins-Regular;
font-size: 23px;
line-height: 1.5;
}
</style>