Limiting user actions by day

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Teonnyn
Forum Commoner
Posts: 58
Joined: Tue Dec 23, 2008 4:07 am

Limiting user actions by day

Post by Teonnyn »

I want to limit what my users can do within a twenty-four hour period. For example, voting for a particular user can only be done once a day but voting can be done five times a day for other users. Once that five-times a day limit is reached, the user has to wait to vote again. I understand that this can be done with a mySQL table, but what is the best way to set timers on this?
User avatar
mikemike
Forum Contributor
Posts: 355
Joined: Sun May 24, 2009 5:37 pm
Location: Chester, UK

Re: Limiting user actions by day

Post by mikemike »

Mark the timestamp when the user voted, then when they come to vote again check the database for the last entry and check the timestamp.
Teonnyn
Forum Commoner
Posts: 58
Joined: Tue Dec 23, 2008 4:07 am

Re: Limiting user actions by day

Post by Teonnyn »

I see. So once users have reached their limits set timestamps and just check against that. Sounds easier then setting up a CRON action :)
Post Reply