Re: freeing resourses after the end of the session

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Heyes wrote:
I made a image validation code, wich generate a image every time the user enters a page.

The name of the image uses the session id, and I save it in a temporary directory.

When the user close the browser (or leave the site) I would have to delete the image (or else I will start to have many garbage images in the temp directory).

   Is there any way to do that? From PHP?

http://uk.php.net/manual/en/function.register-shutdown-function.php

That would work for the end of a request, not the end of a session.

The way I've done this in the past is to implement my own session handler and have that clean up temporary files when the session ends. However, there are less drastic ways to do it such as having a cron job simply delete images from the temp directory if they're older than a few days. Obviously this is less than ideal if the site traffic is high.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux