I have a comment form and I want to stop users flooding the site with comments and potentially crashing the site.
I have a table that all comments are submitted to.
I was thinking to create a table that will create an entry when a user submits a new comment which will contain the users id and a datetime stamp of when the comment was added.
There I would have a check when a comment is added to see if the user has an entry in the database and check the difference between the entry datetime and the current submission datetime.
There would be a trigger in the database to remove entries once they hit a certain criteria like a certain amount of time has elapsed since being added.
My problem here would be how to get the time difference between two datetime stamps in PHP, they would be formatted like so '2010-06-17 13:22:11'.
Any ideas/help much appreciated.
I have a table that all comments are submitted to.
I was thinking to create a table that will create an entry when a user submits a new comment which will contain the users id and a datetime stamp of when the comment was added.
There I would have a check when a comment is added to see if the user has an entry in the database and check the difference between the entry datetime and the current submission datetime.
There would be a trigger in the database to remove entries once they hit a certain criteria like a certain amount of time has elapsed since being added.
My problem here would be how to get the time difference between two datetime stamps in PHP, they would be formatted like so '2010-06-17 13:22:11'.
Any ideas/help much appreciated.
Comment