Delete IP After Set Time

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
TG33
Forum Newbie
Posts: 2
Joined: Wed Mar 21, 2012 6:32 pm

Delete IP After Set Time

Post 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!
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Delete IP After Set Time

Post by Celauran »

You could add an expiry datetime column to the table and create a trigger to delete expired entries.
TG33
Forum Newbie
Posts: 2
Joined: Wed Mar 21, 2012 6:32 pm

Re: Delete IP After Set Time

Post 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?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Delete IP After Set Time

Post by Celauran »

Post Reply