Re: session question
| From: | Greg Donald | Date: | Tue, 07 Dec 2004 17:18:05 +0000 |
| Subject: | Re: session question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-203674@lists.php.net to get a copy of this message | ||
On Tue, 7 Dec 2004 11:50:58 -0500, Josh Howe <jhowe@sinu.com> wrote:
> I've looked at the php session documentation, and it doesn't look like
> there's any way to run code when a session expires. I'd like to do some
> cleanup when a user's session expires, is there any way to trap this?
> Thanks.
You can define your own session handling functions with and override
PHP's default session handling with session_set_save_handler(). One
of the functions you would define would be the garbage collection
function. Once created you can call this function whenever you like.
I wrote a drop-in replacement for PHP sessions that gives you what I
just described, it uses MySQL:
http://destiney.com/pub/php_db_sessions.tar.gz
There's also the database abstraction layer ADOdb which gives you
callback functionality in garbage collection:
http://adodb.sf.net/
The db driven, encrypted and bzip'd sessions are pretty nice too.
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/