Update Script.php

Student can create the accounts on their own without the need for the Teacher to create the accounts for the students. 
Also removed the inputs for the passport.
SIMPLICITY_link
enockkays 2020-12-25 22:21:40 +08:00 committed by GitHub
parent a238909f1a
commit 3ab9c33e8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 7 deletions

View File

@ -77,11 +77,10 @@ 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;
@ -126,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.";
} }
} }
@ -140,7 +138,6 @@ if (!empty($_POST["frm_signup_2"])) {
// ################################ LOGIN ##################################### // ################################ LOGIN #####################################
if (!empty($_POST["frm_login"])) { if (!empty($_POST["frm_login"])) {