I want to replace sha1 with password_hash, and I need to make the password_verify run like: if invalid = do set of functions, else login. However in password_verify manual I only find this:
<?php
if (password_verify($password, $hash)) {
// valid
}
else {
// invalid
}
How do I get something like this:
<?php
if (password_verify($password, $hash)) {
// invalid = run set of functions
}
else {
// login
}
I hope I'm making sense.
Logical Operators: NOT (!)
if (!password_verify($password, $hash)) {
// invalid = run set of functions
}
else {
// login
}
Really basic stuff.
Change
<?php
if (password_verify($password, $hash)) {
// invalid = run set of functions
}
else {
// login
}
to
<?php
if (!password_verify($password, $hash)) {
// invalid = run set of functions
}
else {
// login
}
The ! operator means NOT. So it'll read if not true then invalid, else valid