My site requires users to log in after which the user's id is stored in a session. The db has a field called 'logged_in' with a value 1 when they log in and is changed to 0 when they log out. Problem is that if the user just closes the browser the value stays as 1.
I know that I can check to see if a session exists on the server but can I check if a session with a specific value exists? I guess the literal code would be
if(!isset($_SESSION['user_id'] == 41)){
// do stuff because session with value 41 doesn't exist
}