From e8b4f2611b5169d38479154652989bbc5022629b Mon Sep 17 00:00:00 2001 From: Arjan kc Date: Wed, 12 Oct 2022 08:45:01 +0545 Subject: [PATCH 1/3] Update customerregister.php --- handler/customerregister.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/handler/customerregister.php b/handler/customerregister.php index 4e340a73..9f6d36f8 100644 --- a/handler/customerregister.php +++ b/handler/customerregister.php @@ -3,8 +3,13 @@ $email=$_POST['email']; $password=$_POST['password']; $password2=$_POST['password2']; -if ($password==$password2) { - $sql="INSERT INTO customers(username, password) VALUES('$email','$password')"; + +//encrypting the passwords +$password_hash=password_hash($password, PASSWORD_BCRYPT); +$password2_hash=password_hash($password2, PASSWORD_BCRYPT); + +if ((password_verify($password, $password_hash))==(password_verify($password2, $password2_hash))) { + $sql="INSERT INTO customers(username, password) VALUES('$email','$password_hash')"; $connect->query($sql); echo ""; } diff --git a/handler/customerregister.php b/handler/customerregister.php index 81654f29..2063c35b 100644 --- a/handler/customerregister.php +++ b/handler/customerregister.php @@ -21,10 +21,4 @@ "; } - - - - - - ?> \ No newline at end of file