I’m working to build a module in Pligg CMS which would limit a user to the amount of votes they can give in 24 hours. If they pass the limit (let’s say 40/day) a JavaScript popup comes up to say “slow down!” … similar to how Digg has updated their system.
What is the best way to keep track of the daily votes? Should I query the MySQL database every time a vote is cast to check if they’re passing the limit? Or is it smarter to store the data in some type of physical file on the server? I don’t really know how to build cache data so I’m thinking of creating a function to manually check the amount of votes each time. Would like to hear better suggestions of course!
Use your database and when saving – query the database for the number of votes cast in a specific time period, and if below your threshold, save. If over the threshold, pop back a javascript alert to inform the user of the problem.