Update Script.php

Line 44, 53 - 60  we removed the passport portal not just from the form as our colleagues did but completely. Apart from the change above we also added a portal for inputting the student number on line 64.
SIMPLICITY_link
Samantha 2020-12-25 22:09:36 +08:00 committed by GitHub
parent 6ba6ebe414
commit a238909f1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 14 deletions

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)
@ -70,8 +61,7 @@ if (!empty($_POST["frm_signup_1"])) {
$result98 = mysqli_query($con, "SELECT * FROM `users_table` WHERE Student_ID='$student_id'"); $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; $_SESSION['user_student_id'] = $student_id;
$_SESSION['user_passport'] = $passport;
header("Location: signup.php"); header("Location: signup.php");
return; return;
} }
@ -84,9 +74,6 @@ 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"]);