This is a discussion on "how do i go about this ?" within the PHP Forum section. This forum, and the thread "how do i go about this ? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
how do i go about this ?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
how do i go about this ?
I have a function that allows my users to search my database, and i want to limit the mumber of queries a user can do in a given 24 hour period.
I can write a script that increments a field in my database everytime a user conducts a search, and i can stop them searching if this value is at a given limit. But how do i go about resetting this field to zero every 24 hours? |
|
|
|
||||
|
Re: how do i go about this ?
Hmm, answered every question except the one you asked.
The first theoretical approach that comes to my (alleged) mind is:
Last edited by masonbarge; Mar 17th, 2007 at 11:17. Reason: spacing didn't show |
|
|||
|
Re: how do i go about this ?
sorry if im missing something here... (st patricks and all hic)
But wouldnt i still need to find a way to automatically reset the counter when the clock ticks over to midnight? |
|
|||
|
Re: how do i go about this ?
If you want something simple and quick you could always set up a simple Cron job to reset the counter to 0 across the db table and set it to run at midnight daily...
|
|
|||
|
Re: how do i go about this ?
This wasnt anywhere near as hard as i thought it was going to be.
I just used a unix timestamp to calculate if their last search was 12 hours or more ago... if it was i delete all entries in the data base and start incrementing the counter again. |
![]() |
| Tags |
| php |
| Thread Tools | |
|
|