How to kill all active sessions?
am 10.09.2007 09:36:38 von Ming
Hi all,
I wonder if there is a way to kill all active sessions.
Basically, I want to have a page, for example, foo.php. Whenever users
visit this page, regardless of where they come from, all sessions that
are from my site will be destroyed.
Thanks,
Re: How to kill all active sessions?
am 10.09.2007 10:36:36 von luiheidsgoeroe
On Mon, 10 Sep 2007 09:36:38 +0200, Ming wrote:
> Hi all,
>
> I wonder if there is a way to kill all active sessions.
>
> Basically, I want to have a page, for example, foo.php. Whenever users
> visit this page, regardless of where they come from, all sessions that
> are from my site will be destroyed.
Depends on what kind of session-handling you use. When using the default
'files', it's a piece of cake to delete all session files in the
session_save directory manually offcourse. In a shared hosting environment
it might hugely upset other users, so I'd only recommend it when you have
your own directory.
--
Rik Wasmus
Re: How to kill all active sessions?
am 10.09.2007 11:23:01 von Erwin Moller
Ming wrote:
> Hi all,
>
> I wonder if there is a way to kill all active sessions.
>
> Basically, I want to have a page, for example, foo.php. Whenever users
> visit this page, regardless of where they come from, all sessions that
> are from my site will be destroyed.
>
> Thanks,
>
Hi Ming,
Under normal circumstances you have only 1 PHP session belonging to 1
client.
It is not clear to me what you excactly asking.
Did you create multiple session for 1 user?
(Using different sessionnames)
Or do you have a few subdomains that share the same cookie and thus session?
Or do you want to destroy ALL sessions belonging to all the different
visitors? (If so follow Ricks advise, unless you are on a shared host)
In case you just want to empty the current session:
$_SESSION = array();
will do the trick. It will empty the current session (Not destroy it).
Please elaborate a little more on your current setup/task, so we can
give you to-the-point answers (maybe).
Regards,
Erwin Moller