I've a login system written in PHP. When you login successfully;
<?php $_SESSION[session_id()] = "yourMemberIDHere"; ?>
When you log off;
<?php unset($_SESSION[session_id()]); ?>
Here is my problem. Admin can ban members. Banned members cannot login. But when a member gets banned while he/she online, it does not log off. Because I only do control of ban state at login.
So I know that somewhere in $_SESSION[] array a value equals to "myBannedMemberID". How can I find that $_SESSION key and unset it?
I thought foreach can be useful. But what if there are thousands of members online on my system?
unset($_SESSION[session_id()]);
? session_id() is unique for the visitor, you dont need to check the MemberId.if ($_SESSION[session_id]) $userHasAccess = true; else goToLoginPage();
show us what is your function?