Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-20-2003, 08:50 PM   PM User | #1
Richard
Regular Coder

 
Join Date: Jun 2002
Location: England
Posts: 172
Thanks: 0
Thanked 0 Times in 0 Posts
Richard is an unknown quantity at this point
Settings files to expire

If a file in created using fopen, how can I set it so the file will expire, ie. delete itself after a specified amount of days ?
__________________
\o/
Richard is offline   Reply With Quote
Old 04-20-2003, 10:35 PM   PM User | #2
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,224
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
It cannot be done automatically with PHP. You would need to use a CRON job which is basically a linux scheduling program. You can set it up to run every XX seconds/minutes/days etc. It will execute any command you tell it to at that time which can be a shell script or a php script.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 04-21-2003, 09:53 AM   PM User | #3
missing-score
Senior Coder


 
missing-score's Avatar
 
Join Date: Jan 2003
Location: UK
Posts: 2,194
Thanks: 0
Thanked 0 Times in 0 Posts
missing-score is on a distinguished road
You cannot set an expire, but something I have done before (using a database too), is to get the time when the file was created, and add an ammount of time onto the file. ( say 3600, an hour ), and insert that value into a database, along with the filename.

Providing anyone visits your web page, you check the current time against the time in the db, if the current time is greater, you delete the file with the filename from the db.

If you want more help, post back.
missing-score is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:19 PM.


Advertisement
Log in to turn off these ads.