Removing the 'HashPassword' Column

Edited by Ashly
Removed the insertion of encripted password into the 'HashPassword' column. All passwords are kept in the 'Password' Column.

Also adjusted the Column size of database to hold the long hashed password
pull/17/head
CloudStarTreck 2020-03-19 19:49:41 +08:00
parent cdd4dceb0a
commit e3dafae622
3 changed files with 4 additions and 5 deletions

View File

@ -123,10 +123,9 @@ if (!empty($_POST["frm_signup_1"])) {
return; return;
} }
//applying password_hash() //applying password_hash()
$sha512=hash('sha512', $password);
$password_hash = password_hash($password, PASSWORD_DEFAULT); $password_hash = password_hash($password, PASSWORD_DEFAULT);
$sql= "INSERT INTO `users_table`(`Email`, `Password`, `HashPassword`, `Full_Name`, `UserType`, `Student_ID`, `Passport_Number`) VALUES " $sql= "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`, `Student_ID`, `Passport_Number`) VALUES "
. "('$email','$password_hash','$sha512','$fullname','Student','$student_id','$passport')"; . "('$email','$password_hash','$fullname','Student','$student_id','$passport')";
if ($con->query($sql) === TRUE) { if ($con->query($sql) === TRUE) {
header("Location: Courses.php"); header("Location: Courses.php");

View File

@ -187,7 +187,7 @@ CREATE TABLE `students_data` (
CREATE TABLE `users_table` ( CREATE TABLE `users_table` (
`User_ID` int(11) NOT NULL, `User_ID` int(11) NOT NULL,
`Email` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL, `Email` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL,
`Password` varchar(50) CHARACTER SET utf8 DEFAULT NULL, `Password` varchar(250) CHARACTER SET utf8 DEFAULT NULL,
`Full_Name` varchar(50) CHARACTER SET utf8 DEFAULT NULL, `Full_Name` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
`UserType` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL, `UserType` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL,
`Student_ID` varchar(500) COLLATE utf8mb4_bin DEFAULT NULL, `Student_ID` varchar(500) COLLATE utf8mb4_bin DEFAULT NULL,

View File

@ -249,7 +249,7 @@ INSERT INTO `students_data` (`ID`, `Student_ID`, `Passport_Number`) VALUES
CREATE TABLE `users_table` ( CREATE TABLE `users_table` (
`User_ID` int(11) NOT NULL, `User_ID` int(11) NOT NULL,
`Email` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL, `Email` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL,
`Password` varchar(50) CHARACTER SET utf8 DEFAULT NULL, `Password` varchar(250) CHARACTER SET utf8 DEFAULT NULL,
`Full_Name` varchar(50) CHARACTER SET utf8 DEFAULT NULL, `Full_Name` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
`UserType` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL, `UserType` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL,
`Student_ID` varchar(500) COLLATE utf8mb4_bin DEFAULT NULL, `Student_ID` varchar(500) COLLATE utf8mb4_bin DEFAULT NULL,