title: session_destroy() not working
body: <p>My session_destroy () does not work. When I logout as a user, and I go back on my browser, show user online. Where I have the error? Thanks. :-)</p>
  
  <p>file login.php</p>
  
  <pre><code>&lt;?php
  require_once('functions.php');
  if(isset($_POST['submit'])){
      if((isset($_POST['username']) &amp;&amp; $_POST['username'] != '') &amp;&amp; (isset($_POST['password']) &amp;&amp; $_POST['password'] != '')){
          $connection = conectDatabase();
          $query = "SELECT * FROM users WHERE username='" . $_POST['username'] . "' AND password='" . $_POST['password'] . "';";
          $result = $connection-&gt;query($query);
          if ($result-&gt;num_rows &gt;0){
               session_start(); 
               $_SESSION['username'] = $_POST['username'];
               header('LOCATION: users.php');  
          } else {
               echo '&lt;p class="formMessage"&gt;Username/password do not match !&lt;/p&gt;';
          }
      } else {
          echo '&lt;p class="formMessage"&gt;Username/Password field is empty&lt;/p&gt;';
      }
  }                        
  ?&gt;
  </code></pre>
  
  <p>file functions.php</p>
  
  <pre><code>&lt;?php
  function conectDatabase() {
      $connection = new mysqli('localhost', 'root', '', 'DB');     
  
      if(mysqli_connect_errno()) {
          die("error DB: " . mysqli_error() . "(" . mysqli_connect_errno() . ").");
      }
      return $connection;
  }
  ?&gt;
  </code></pre>
  
  <p>file logout.php</p>
  
  <pre><code>&lt;?php 
      session_start();
      session_destroy();
      header('LOCATION: login.php');
  ?&gt;
  </code></pre>