A Question Regarding Session Lifetime

Hello,

I think that my question is actually the same one as in [url=https://forum.infinityfree.net/t/session-persists-after-closing-browser/53539]this topic[/url], but that thread no longer accepts replies and so I had to start a new one.

So, the problem is that previous sessions persist even after entirely closing and subsequently reopening the browser.
To demonstrate this, create 2 scripts. Launch this one before closing your browser:
[code]<?php

session_start();

$_SESSION['test'] = 'The session persists!';[/code]

Next, open this script directly after launching your browser again:
[code]<?php

session_start();

echo $_SESSION['test'];[/code]

If you do so, you will
 see the session persist message.
I know that the session data does not automatically get destroyed when one closes their browser, but what to do if I want to prevent resuming the previous session after reopening the browser?

Many thanks.

The answer in this thread should help you out:

11 Likes

Amazing, thank you.

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.