Reputation: 3
I am new to php. I just want to ask how to show login failure message as a POPUP and not on a new page. What should I replace on the command "print
"?
if($login_check > 0){
while($row = mysql_fetch_array($sql)){
// Get member ID into a session variable
$id = $row["id"];
session_register('id');
$_SESSION['id'] = $id;
// Get member username into a session variable
$username = $row["username"];
session_register('username');
$_SESSION['username'] = $username;
// Update last_log_date field for this member now
mysql_query("UPDATE members SET lastlogin=now() WHERE id='$id'");
// Print success message here if all went well then exit the script
header("location: member_profile.php?id=$id");
exit();
} // close while
} else {
// Print LOGIN FAILURE MESSAGE to the user and link them back to your login page
print '<br /><br /><font color="#FF0000">No match in our records, try again </font> <br />
<br /><a href="login.php">Click here</a> to go back to the login page.';
exit();
}
Upvotes: 0
Views: 949
Reputation: 2839
You have to go for javascript alerts or some jquery custom popups.
There is one jquery plugin Impromptu, in which you can show customized popups. It also has other features.
You can display Login failure message as show below along with the callback to go back to previous page :
$.prompt('Login Failed',{
close: function(){
window.location.href = "page_url";
}
});
for more details, refer to this link
Upvotes: 1