Here is how I solved the problem assuming that you are running a session After a successful login do this:
if ($step != 1)
$_SESSION['step']=1;
header(location: redirect.php);
}
else{
//Code for successful login
}
The redirect.php page simply redirects them back to the login page.
