session destroy callback (onSessionDestroy event)

This is a discussion on session destroy callback (onSessionDestroy event) within the PHP General forums, part of the PHP Programming Forums category; Hi, I need to do some clean-up when the session is destroyed or values are removed from it (expired). ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-13-2007
Emil Ivanov
 
Posts: n/a
Default session destroy callback (onSessionDestroy event)

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.
Reply With Quote
  #2 (permalink)  
Old 05-14-2007
Mike P2
 
Posts: n/a
Default Re: session destroy callback (onSessionDestroy event)

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

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:12 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0