If a user opens a session, I would like to destroy all other sessions that he might have.
I know session_destroy();
but it destroys only the current session.
How can I do to destroy another session? (I know the other session id)
If a user opens a session, I would like to destroy all other sessions that he might have.
I know session_destroy();
but it destroys only the current session.
How can I do to destroy another session? (I know the other session id)
If you have the session id for the session you want to destroy, you can pass it to session_start()
to resume that session, destroy it, then call session_start()
again to create the new session. I haven't tried this to confirm it will work, but it seems like it ought to.
If you do not have the session id for the session you want to destroy, I'm not sure there's a sane, clean, portable way to do this.