0
My intention is to call a page redirect if the password is not correct using header(), however, I realized that it was not working. I’ve been reducing the tests and I’ve come this far:
// Senha Certa
$senha = 'Teste123';
// Senha Errada
$senha = 'Teste1234';
// hash que combina com a senha 'Teste123'
$hash = '$2y$10$QW0qR0mI1oOB733baaleSe.aXwwAhJlpV6G5vOprKqP14HdcbECO.';
// Verificação da senha
if(!password_verify($senha, $hash)){
header("Location: acesso-negado.php");
//die("Usuário ou Senha Invádios");
}
header("Location: index.php");
Putting the wrong password, I realized that it ignores the header("Location: access-denied.php") and continues normally until it reaches the header("Location: index.php") and finally gets redirected.
I also noticed that if you put a die() under the header("Location: access-denied.php") it starts working correctly.
Does anyone know why redirecting only occurs with the use of die() below it? I am using php 7.2.7
There must be some confusion, or the variable returns true and executes the condition or not .
– MagicHat
Exactly, I’m finding it all very strange. Let’s see if someone takes the test and tell if they’re also having the same problem.
– MichellHenrique