How to kill all active sessions?

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

Threaded View
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.


Re: How to kill all active sessions?

Quoted text here. Click to load it

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?

Ming wrote:
Quoted text here. Click to load it

Hi Ming,

Under normal circumstances you have only 1 PHP session belonging to 1  

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).

Erwin Moller

Site Timeline