TeamPhotoshop
Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
Forum Home Latest Posts Search Help Subscribe

Timed deletion script (PHP)

Page: 1 Reply
Jan 4th 2004#135877 Report
Member since: Apr 20th 2002
Posts: 3000
Is there a way for me to have like an expiration time on files that are created through a script? For example, if I were to have a script generate txt or image files, but instead of having it being stored on the server until I manually delete it, I would specify a time (say .. time()+3600) when it gets automatically deleted.
Reply with Quote Reply
Jan 4th 2004#135882 Report
Member since: May 22nd 2003
Posts: 315
Could you use mysql?

If not you could have a file that is read and if the date is old... it'll delete the files...
Reply with Quote Reply
Jan 4th 2004#135936 Report
Member since: Nov 6th 2001
Posts: 240
Could you be a little more specific.. what are you trying to do? Maybe we can come up with something. I thinks it's possible to do.

You could use a flat file that saves the filename/file_creation_date whenever a new file is made. Each time you run the script you could read the file and check for dates that are expired, if they are expired, they are deleted automatically.
Reply with Quote Reply
Jan 5th 2004#136099 Report
Member since: Mar 20th 2001
Posts: 3367
Some logic I would implement... The files uploaded has a timestamp on its filename. From script, read the filename's timestamp and delete accordingly.

You might need to setup a cron job for this to run periodically.
Reply with Quote Reply
Jan 5th 2004#136101 Report
Member since: Apr 20th 2002
Posts: 3000
Thanks for the suggestions .. I guess I can run a script that checks for dates on the index page of me site .. so whenever someone surfs to it, it'll run the script and check ...

And cron what? *googles*

edit* well after a quick read, I learned what they are, what they do, how to set them, etc. The only problem is, the ability to set cron job's isn't available from the cpanel and I can't gain access to the server to set it manually. :(
Reply with Quote Reply
Jan 5th 2004#136137 Report
Member since: Mar 20th 2001
Posts: 3367
There is an cron job option in cpanel.. Whoever did the design of the theme for yours needs a kick in the butt. For cpanel, its pretty easy to setup, just the frequency.. etc and the path of your script and the executer.

Request a cpanel theme change.. Xskin or Bluelagoon for more complete ones.
Reply with Quote Reply
Page: 1 Back to top
Please login or register above to post in this forum