Jump to content


This topic is now archived and is closed to further replies.


javascript count number times login is wrong

Recommended Posts

on my login script i want it to display a message only if they have got the username and password wrong more than once. I have tried various while loops and so on but cant get it to only display one time because of the loop it keeps displaying the message again and again.

Share this post

Link to post
Share on other sites
I'm not sure I follow what your doing... whats w/ the loops? Maybe post a bit of code.

I use php session to track failed loggins...


//check for valid log in.
//if it works, log them in,
//if it fails...
$_SESSION['logInAttempts'] = ++; //add 1 to the current value.
if($_SESSION['logInAttempts'] > 3){
header("Location: youLose_nowGoAway.php");
Then, in your form, when it reloads

failed Login. You have attempted to log in <?php echo $_SESSION['logInAttempts'] ?> time(s)

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.