I have been looking for a way to log all my users out except the one activating this command? if there a way to do this... I have the following code below but I am not even sure if it 100% works as it said "try"
ini_set('session.gc_max_lifetime', 0);
ini_set('session.gc_probability', 1);
ini_set('session.gc_divisor', 1);
So I want to clear all the sessions (session_destroy) on each session except for the session viewing the page?? is this possible..
I think in this case more right way - create custom code to logout all users. For example I can suggest this solutions:
You can store in database special parameter last_users_logout_time
and when user login then store in $_SESSION array variable user_login_time
. And in every page you can check if user_login_time
< last_users_logout_time
or user_login_time
is null then logout user. Very simple. For ignore specified user you can add parameter except_logout_user_id
into database
More "right way" - store $_SESSION data in database and just run DELETE
query for all session
table except specified user
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.