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)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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 callsession_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.