Hi,
I need to do some clean-up when the session is destroyed or values are
removed from it (expired).
using session_set_save_handler does not work for me, as I don't want to
rewrite session handling, I just need to be notified when a value is
destroyed.
Regards,
Emil Ivanov
P.S. I'm dealing with temporary pictures, saved on the disk and their path
stored into the session and I need to delete them when they are no longer
needed.
On May 13, 1:51 pm, emil.vla
@gmail.com ("Emil Ivanov") wrote:
> Hi,
> I need to do some clean-up when the session is destroyed or values are
> removed from it (expired).
> using session_set_save_handler does not work for me, as I don't want to
> rewrite session handling, I just need to be notified when a value is
> destroyed.
> Regards,
> Emil Ivanov
> P.S. I'm dealing with temporary pictures, saved on the disk and their path
> stored into the session and I need to delete them when they are no longer
> needed.
You are probably better off using session_set_save_handler() anyway.
There is a security risk if you don't have the PHP setting for the
save path of sessions changed and you are on shared hosting (anyone
can access the temporary directory). You can easily rewrite the code
to save the session data in files, it's serialized anyway.
If you really prefer, you can save the session file IDs in a database
and check (with a cron job) if that session file still exists in /tmp/
or your temporary directory.
-Mike PII