Jump to content

Recommended Posts

Hello, I am building a simple Student Portal using PHP OOP Concept. 
A platform where student can check their exam result using PIN given out by the admin and it can only be used 3 times only.
 

Please I am new to PHP OOP Concept, kindly help me

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/315466-how-to-limit-login-attempt-to-3/
Share on other sites

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

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
  • 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.

9 hours ago, BillInKCMO said:

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

Not according to the first post...

On 10/28/2022 at 10:58 AM, Syntaxbyte said:

using PIN given out by the admin and it can only be used 3 times only.

 

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.