Search code examples
phpsessionsessionid

Unset a specific session using session id


I am the administrator of the site. I want unset a particular session, and I know its session id.

The users are just starting the session like this:

session_id("usernumber");
session_start();

Let’s say user A has usernumber "123".

I want to destroy all the values of the user A. User A will not regenerate the sessio_id() after setting that as session_id("123");.

How can I unset destroy only for user A?


Solution

  • Without reverse enginering the session handler....

    <?php
    
    session_id($_GET['killsid']);
    session_start();
    session_destroy() || die "failed to kill";