Jump to content

Limiting Login


Recommended Posts

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.

Kevin
Link to comment
Share on other sites

  • 2 weeks later...
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?
Link to comment
Share on other sites

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

or

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


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.