Page 1 of 1

Delete IP After Set Time

Posted: Wed Mar 21, 2012 6:34 pm
by TG33
Hi everyone, I'm new here and fairly new to PHP. My question is, I have a vote system in WordPress that uses JavaScript to set a cookie that will disable the vote button for a specified period of time and I use PHP to send the voter's IP to a database. How can I set that IP to be deleted from the database after a specified period of time (10 seconds, 1 day, 1 week, or whatever) from the initial vote?

Thanks to anyone for any help!

Re: Delete IP After Set Time

Posted: Wed Mar 21, 2012 6:40 pm
by Celauran
You could add an expiry datetime column to the table and create a trigger to delete expired entries.

Re: Delete IP After Set Time

Posted: Wed Mar 21, 2012 7:30 pm
by TG33
Celauran wrote:You could add an expiry datetime column to the table and create a trigger to delete expired entries.
I'm not sure how to begin this process. Any code snippets to get the ball rolling?

Re: Delete IP After Set Time

Posted: Wed Mar 21, 2012 7:55 pm
by Celauran