[nycphp-talk] Checking active sessions
Rob Marscher
rmarscher at beaffinitive.com
Mon Apr 30 19:00:50 EDT 2007
On Apr 30, 2007, at 1:34 PM, David Krings wrote:
> Ah, now I see. Well, that would be one option, but one that
> wouldn't be part of my script and thus not portable that easily. It
> for sure would be faster and not burden the clients. I rather have
> me remove the mess I make than rely on some 3rd party to do the
> cleanup. I plan on adding configurable system settings at some
> point and may make this optional. Someone who doesn't like this can
> turn it off and do it on their own.
I believe Adrian was showing how ADODB uses a Unix command to clean
up it's files and saying that you could also use a Unix command. I'm
not sure I would call it "3rd party" if you're always using a unix-
based server. Of course, it wouldn't be portable to Windows.
At any rate, you can use PHP's filesystem functions to go through
your directories and figure out the last time they were changed via
filemtime(): http://us.php.net/manual/en/function.filemtime.php
On a side note, if you use custom session save_handlers like I
mentioned before, then you can know which sessions are active. I use
custom save_handlers to store all of my sessions in a database rather
than in temp files. Then I can just query the database to find
active sessions. The only downside is I'm not sure what libraries/
classes there are for storing sessions in a database that are easy to
use and up to date. As I'm sure Chris' recent presentation showed
(unfortunately I had to miss it... audio recording?), there are many
ways for sessions to be compromised.
Anyone know of a good, up-to-date, database session library? I
originally used DB_eSession, but it hasn't been updated since 2004
and my version has been very customized and patched over the years.
I think I'm happy with it, but would like to review some other code
if there are other options out there.
Thanks,
Rob
More information about the talk
mailing list