I am a beginner at PHP, but I am wanting it that a user is able to post a comment 10 times, in the period of 24 hours. If they reach 10 comments before this 24 hours is up, they will get a message saying something like “You can not post any more comments”, and after the 24 hours, they are able to post again.
Any ideas on how I can do this?
Thanks.
Store the username and timestamp with each comment in your database.
When someone tries to comment, make an SQL query to return the comments where that user made the comment and the time was in the last 24 hours.
If there are 10 results, show the user an error message.
Otherwise process as normal.