title: logging out a user completely from a website
body: <p>I have  a <code>PHP login</code> and log out script and what I'm trying to achieve  is that when the user click on the log out link he completely logs out, regardless clicking the back button of the browser, and do not want the user to access the page.they should be redirected to the <code>login</code> page</p>
  
  <p>this is login function</p>
  
  <pre><code>function loggedin() {
      if ( isset($_SESSION['user_id']) &amp;&amp; !empty($_SESSION['user_id']) ) {
          return true;
      } else{
          return false;
      }
  }
  </code></pre>
  
  <p>and this is my logout script</p>
  
  <pre><code>&lt;?php
  include 'includes/connect.php';
  include 'includes/functions.php';
  
  session_destroy();
  header('location: index.php');
  
  ?&gt;
  </code></pre>
  
  <p>how can i achieve this??</p>