Jump to content


Limiting Login

  • Please log in to reply
2 replies to this topic

#1 kevin_it

  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 01 September 2006 - 11:59 AM

I am using php 5 and MySQL 4.0.18, and would like to accomplish the following on my page:

I would like to only limit the user to only login every 2 weeks for a period of 4 days. So for example, they can login in Saturday, Sunday, Monday and Tuesday, but from that Wednesday to 2 weeks later they are not allowed to login, it should go to a countdown page saying you have xx days until you can login again.

Confusing? I am a partial newbie, but am getting better at php. Let me know if there is anything else I can contribute to try and explain better.

Thanks all.


#2 redcore

  • New Members
  • Pip
  • Newbie
  • 8 posts
  • LocationCentral California

Posted 14 September 2006 - 03:32 AM

Couldn't you have a "last_login" field in your SQL table...then when someone tries to login, if the current date is 2 weeks from the day they last logged in then it sets a 4 day cookie and moves on but if not then it tells them how many days until they are permitted access?

#3 Zane

  • Administrators
  • Advanced Member
  • 4,134 posts

Posted 14 September 2006 - 05:09 AM

Well concept-wise
you're either going to have set up a cron job to update everyone in your databases remaining usage time, every day


have it run a script to check that every time they log in....

If you just have a small based thing I would go with the second option
just add some code to your login script, where after they've successfully logged in
it runs a check to see if they have lapsed their limit yet or not...

btn_donate_SM.gif Want to thank me? Contribute to my PayPal piggy-bank


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users