Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Login Tries

 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Respected Sir/Madam,

I have the following requirements:

1. System shall display Captcha after 3 failed login tries
2. System shall ban the IP for 24 hours after 9 failed tries

I am thinking to do in following steps:
1- put IP into session
2- count tries for that IP
3- when tries++=3 then show captcha
4- if tries++=9 then ban IP for 24 hours

I can do first 3 steps but how can I ban IP for 24 hours? may I insert into a db table or is there any other solution?

Best regards

 
Nicola Garofalo
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you could.

You could insert the time of the ninth login attempt in a db table.
Everytime the same ip tries to login, you compute the difference between the login time and the time you stored in your db table.
If this difference is 24 hours or more you allow the login.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nicola Garofalo wrote:Yes, you could.

You could insert the time of the ninth login attempt in a db table.
Everytime the same ip tries to login, you compute the difference between the login time and the time you stored in your db table.
If this difference is 24 hours or more you allow the login.


Thanks a lot. Appreciated

Bet regards
 
Nicola Garofalo
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are welcome Farakh, it's just an idea anyway.

I hope you will find other even more valuable and effective ideas.

If you encounter problems in the implementation, just post them here and we can comment them together.
 
Alpesh Padra
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use flat file instead of Database for better performance.

because for making DB connection and fire select statement performance hit for application.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"love java", please check your private messages for an important administrative matter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic