11-14-2007, 11:42 PM
I have a forum something similar to yahoo answers and I was wondering how I could set a particular question to expire after a certain amount of time. For example someone asks the question and then 3 days later it expires and is closed. I imagine that it is somehow related to a cron job but am not sure how the general proccess would go. could someone help me out with this?
11-14-2007, 11:55 PM
how about using server cookies? (can't remember if they exist in php)
if time now = time then +3 days then expire
11-15-2007, 12:09 AM
$_SESSION is the way to go
11-15-2007, 04:57 PM
Uhhhh... Sessions do nothing for this, and I've never even heard of server cookies.
You have to do this in a database, store the timestamp, and then as you mentioned use a CRON job to mark old questions as expired. The script runs every (1 hour, 1 day, depends on how important it is);
select all questions from table where timestamp is older than 3 days, collect all IDs, then do an update set expired = 1 where ID in (1, 3, 5, etc.)
11-15-2007, 07:43 PM
That was along the lines of what I was thinking but didn't know if there was a better way of doing it. Thanks alot