$username = $_POST['username'];
$password = $_POST['pass'];
$query = "SELECT id,name,username,password,status FROM users WHERE username = " . $dbh->quote($username);
$result = $dbh->query($query);
$userData = $result->fetch(PDO::FETCH_ASSOC);
$userName = $userData['username'];
$hash = $userData['password'];
$status = $userData['status'];
if($username == $userName)
{
if(password_verify($password, $hash))
{
if($status == 'Request')
{
echo "<script>alert(\"You have not been activated. Please contact admin for more info.\")</script>";
}
else
{
session_start();
$_SESSION['sess_user_id'] = $userData['id'];
$_SESSION['sess_name'] = $userData['name'];
echo "<script>window.location.href = \"home.php\"</script>";
}
}
else
{
echo "<script>alert(\"Incorrect Password!\")</script>";
}
}
else
{
echo "<script>alert(\"Incorrect Username!\")</script>";
}
What i mean by not working is this part :
if($status == $request)
{
echo "<script>alert(\"You have not been activated. Please contact admin for more info.\")</script>";
}
else
{
session_start();
$_SESSION['sess_user_id'] = $userData['id'];
$_SESSION['sess_name'] = $userData['name'];
echo "<script>window.location.href = \"home.php\"</script>";
}
when I insert the incorrect username and the correct password i get : Incorrect username
when i insert incorrect password and the correct username i get : Incorrect password
When I insert the correct username and password I should get : You have not been activated. Please contact admin for more info. instead i get : Incorrect Password.
what am i missing? help please.