i have a the following logon script on my website which works well:
<?php
include 'pdo_connect.php';
if(!empty($_POST)) {
$query = "SELECT `password` FROM `users` WHERE `uname` = ?";
$params = array($_POST['uname']);
$results = dataQuery($query, $params);
}
$hash = $results[0]['password']; // first and only row if username exists;
if (password_verify($_POST['upassword'], $hash))
{
session_start();
$_SESSION["loggedIn"] = true;
$_SESSION["username"] = ($_POST['uname']);
echo "<script>window.location.replace('main.php')</script>";
}
else
{
echo 'Invalid username/password, are you registered?';
}
?>
If a user enters an incorrect password for the username it returns a simple message but if you enter a wrong username it returns this: