In the login.php i check if everething is ok and if its i creat the session and redirect the user
$success = $dbh->prepare("SELECT UserId FROM users WHERE username =:username
AND password=:password");
$success->bindParam(':username', $username);
$success->bindParam(':password', $password);
$success->execute();
$rowSuccess = $success->fetch();
$user_id = $rowSuccess['userid'];
$_SESSION['user_id'] = $user_id;
$_SESSION['loggedIn'] = 1;
So how to destroy the user session when i delete him if he is still logged in