Jump to content

How to limit login attempt to 3


Syntaxbyte

Recommended Posts

This is not yet an OOP thingie.  It is a simple programming thingie.  If you Want to use OOP, fine, but first put some code together to show us what you are having problems with.   That will answer the question whether it is your algorithm or you knowledge of using OO

Link to comment
Share on other sites

How about a database table with a column called "logins".

Add 1 to the user each time there is a successful login.

Then, if logins == 3, create a warning message that indicates they've reached the limit.

(Heck, you can even use this to create a message at every visit to indicate how many visits are remaining for that user.)

Edited by phppup
Typos
Link to comment
Share on other sites

  • 2 weeks later...
On 11/1/2022 at 4:14 AM, phppup said:

How about a database table with a column called "logins".

Add 1 to the user each time there is a successful login.

Then, if logins == 3, create a warning message that indicates they've reached the limit.

(Heck, you can even use this to create a message at every visit to indicate how many visits are remaining for that user.)

I think you mean, add 1 when there is an UNsuccessful login.

...and then, the next step is to set the counter to zero if there's a successful logon. 

A less secure way would be to store the count as a cookie, but if you've got a tech savvy user they can just delete it and have infinite attempts.

OR make the login process an Ajax POST and do the counting with in-page javascript, though there's no long term storage for that beyond cookies.

DB is the best answer, frankly.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.