Problems with session...

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am wondering what goes wrong...
I have


How can I check whether the _last_ session (from e.g. yesterday) has
My problem is, that once logged in, it remembers it forever. All
$_SESSION variables will stay and will confuse my software next time
they open a browser again, as it can see that the $_SESSION data are
still present...
Is there a way to get to know, that the session has ended, or the
browser has been closed?


Re: Problems with session...

jodleren schreef:
Quoted text here. Click to load it

Hi Jodleren,

You cannot, unless you use own sessionhandlers.

Quoted text here. Click to load it

Possibly this happens because nobody else use that site.
Sessions are destroyed besaed on a random generator.

On the top of my head it is dafault configured with a chance of 1/100
the system will check for stale sessions.
This means that EVERY request to PHP has a 1/100 chance of firing the
session-garbage collection.

Check you php.ini for excact sessting (or use phpinfo()).

Quoted text here. Click to load it

Browser close? No.
Session ended? Yes, with proper session_save_handler (via a db eg).

Erwin Moller

Quoted text here. Click to load it

"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare

Re: Problems with session...

On 22 Oct, 16:33, Erwin Moller
Quoted text here. Click to load it

You can't have a session without using a session handler. You can roll
your own, but there's no need. The default session handler just uses
files - see session.save_path for the directory. To find out when the
session was last used check the mtime (or the atime - but that may
have been updated by backup software etc).

Quoted text here. Click to load it

Note that the session will be considered closed if its not accessed
after session.gc_maxlifetime, even thought the file may still persist.
Its only cleaned up when the housekeeping job kicks in (based on a
dice throw when any session_start using the same handler is called for
any session).


Site Timeline