this validation page doesn't show error and doesn't redirect to the home page. I check if it reach the verifying from the databse and it works fine but doesn't redirect the page so I think that the problem is with "$user = $req->fetch()" help plz
if(isset($_POST['login'])){
$username = $_POST['username'];
$password = $_POST['password'];
$pc = md5($password);
$req = $pdo->prepare('SELECT * FROM users WHERE nom= :username AND pass= :password');
$req->execute(array(
'username' => $username,
'password' => $pc,
));
if ($user = $req->fetch()) {
$_SESSION['auth'] = $user;
header("location:home.php");
exit();
}
else{
echo"<script> alert('LE NOM D UTILISATEUR OU LE MOTS DE PASSE INCORRECTE')</script>";
}