简体   繁体   中英

How to delete NOT CURRENT session?

Lets say I'm writing account and user roles system. I have:

session_start();
$_SESSION['username']; //if its set user is logged

My site has admin panel with list of users. I want to make "delete user" button. This button should delete server cookie of chosen user to immediately delete his account (if troublesome user was logged in that time he should lost all access to website).

I can't use session_destroy() because it destroying current session (mine) and not session of my not longer wanted user.

How to delete session of not current user?

// edit Please read carefully question. I don't want to clear my session with unset($_SESSION['my_var']). I want to unset someone else session.

Bill is admin of site. Sally is user. Bill wants to immediately delete Sally account, he removed her from database but Sally is still able to traverse site because her server cookie is still valid (she never executed any code with unset($_SESSION['Sally])).

unset( $_SESSION['username'])应该可以解决问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM