-1

This are the line of codes i use but it logout all users(accounts) that are logged in at the time and i need to know how can i solve my problem please help me soon the code under are the one i use for logging out but the problem is that when am logging out it's logout all the accounts that are logged in at the time.

<?php  
if (isset($_GET['logout'])) {
        unset($_SESSION['id']);
        unset($_SESSION['role']);
        session_unset();
        session_destroy();
        header('location:../login_form.php');


     }


    
?>
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
  • This has nothing to do with javascript or mysqli so I emoved those tags. Now, did you start the session here? If you did, what you posted should work. What does error reporting reveal? – Funk Forty Niner Aug 01 '20 at 03:42

1 Answers1

0

From the PHP manual

The session_unset() function frees all session variables currently registered. session_destroy() destroys all of the data associated with the current session.

Just don't do session_unset(). Clearing the specific session variables is usually enough and preferred.

Fred
  • 74
  • 4