954,597 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

limiting the execution of a function for n number of times everyday and resetting it

Hi,
Can any body provide me some code reference regarding,how to limit execution of a function to a registered user everyday for n number of times.Like user can only send 20 mails everday.so allowing execution of mail function for only 20 time everday and resetting the counter the next day and showing error fot the same if the limit is reached.

sujitrulz
Newbie Poster
3 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

Store the limit and a last changed date in a table. Before updating a value, see when it was changed last, to determine if it should be reset.

pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 
Store the limit and a last changed date in a table. Before updating a value, see when it was changed last, to determine if it should be reset.


hi thanks priteas, i wana know if i can user crons to reset the counter like, suppose around 12 am the reset function should be deactivated..i m still confused..

sujitrulz
Newbie Poster
3 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

Yes. Make a php script to reset all values, and execute it through your crontab.

pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: