Syntaxbyte Posted October 28, 2022 Share Posted October 28, 2022 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 Quote Link to comment https://forums.phpfreaks.com/topic/315466-how-to-limit-login-attempt-to-3/ Share on other sites More sharing options...
ginerjm Posted October 28, 2022 Share Posted October 28, 2022 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 Quote Link to comment https://forums.phpfreaks.com/topic/315466-how-to-limit-login-attempt-to-3/#findComment-1601992 Share on other sites More sharing options...
phppup Posted November 1, 2022 Share Posted November 1, 2022 (edited) 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 November 1, 2022 by phppup Typos Quote Link to comment https://forums.phpfreaks.com/topic/315466-how-to-limit-login-attempt-to-3/#findComment-1602145 Share on other sites More sharing options...
BillInKCMO Posted November 12, 2022 Share Posted November 12, 2022 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. Quote Link to comment https://forums.phpfreaks.com/topic/315466-how-to-limit-login-attempt-to-3/#findComment-1602485 Share on other sites More sharing options...
Barand Posted November 12, 2022 Share Posted November 12, 2022 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. Quote Link to comment https://forums.phpfreaks.com/topic/315466-how-to-limit-login-attempt-to-3/#findComment-1602493 Share on other sites More sharing options...
BillInKCMO Posted November 15, 2022 Share Posted November 15, 2022 On 11/12/2022 at 3:21 AM, Barand said: Not according to the first post... Yep, you're right. I misread. Quote Link to comment https://forums.phpfreaks.com/topic/315466-how-to-limit-login-attempt-to-3/#findComment-1602620 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.