Jump to content

Archived

This topic is now archived and is closed to further replies.

kevin_it

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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
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...


Share this post


Link to post
Share on other sites

×

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.