How to implement a mechanism to ban and delete a user session?
Arose the need to have for the admins the ability to ban user on the website.
He implemented the ban, but it is necessary that if there is a session (user is online) - she was purged or deleted immediately after pressing the button "ban", display the appropriate message.
The first thing that comes to mind, using the table of sessions on codeigniter - add a user_id field and let Ajax to check the status of the field if user_id exists, then the session alive, if no session->destroy().
Figured if so will check 10K users, for example, will be quite expensive.
Are there any other ways to implement open someone else's session without the constant reference in the database?
Sherman.Wilkinson answered on April 19th 20 at 12:07
Well I understand the ban is in some sort of users table field isBan = true?
Well, do to the user when loading any page checked this box, and if it is true, peel session, redirected where you want....
PS If unbearable, then Jaxom bullet every 10 seconds and if banned, then clean the session and give a beautiful pop-up
trent.Simonis answered on April 19th 20 at 12:09
Do not quite understand the application architecture. Like PHP and Ajax is assumed.
If you have PHP, you just need to reload the page each time to validate the user. Or if you want that already open page is closed? How much it matters in PHP. Let them look, next reboot and all the more no access. When you restart the message and to show that there is no access.