title: How can I disable the back browser button after user press logout and destroy session?
body: <p>I am having trouble with <code>session_destroy()</code>.</p>
  <p>When the User press <em>Log out</em> it have to destroy the session. I wrote the following code:</p>
  <p><em><strong>Logout.php</strong></em></p>
  <pre><code>&lt;?php
      session_start();
      session_destroy();
      header(&quot;location: LoginViewController.php&quot;);
  ?&gt;
  </code></pre>
  <p>After pressing <em>log out</em>, when I press the browser back button it is showing my previous Logined user page and session username in <em>Login.php</em> page</p>
  <p><em><strong>Login.php</strong></em></p>
  <pre><code>&lt;?php
      session_start();
      $_SESSION['user']=  $_GET['username'];
      echo '&quot;&lt;div style=&quot;background:white; text-align:right&quot;&gt; Login as:'.$_SESSION['user'].'&lt;/div&gt;&quot;';
      echo '&lt;a href=&quot;Logout.php&quot; style=&quot;text-align:right&quot;&gt;Logout&lt;/a&gt;';
  </code></pre>
  <p><em><strong>LoginViewController.php</strong></em></p>
  <pre><code>&lt;?php
      header(&quot;Cache-Control: no-store, no-cache, must-revalidate, max-age=0&quot;);
      header(&quot;Expires: Sat, 26 Jul 1997 05:00:00 GMT&quot;);
  
      $Username = $_POST['uname'];
      $Password = $_POST['pwd'];
      $User_Type=$_POST['type'];
  
      If (!(empty($Username) &amp;&amp; empty($Password) &amp;&amp; empty($User_Type))){
          $model = new UsersModel();
          $rowsCount = $model-&gt;checkUser($Username,$Password,$User_Type);
  
          if ($rowsCount!=0){
              header(&quot;location:login.php?username=&quot;.$_POST['uname'].&quot;&quot;);  
          } else {
              echo '&lt;script type=&quot;text/javascript&quot;&gt;alert(&quot;Enter username and password correctly&quot;);
              window.location.href=&quot;LoginViewController.php&quot;;&lt;/script&gt;';
          }
      }
  </code></pre>
  <p>I don't know why it is working like that.</p>
  <p>Please help me to find out where I commit mistake.</p>
  <p>I want to disable that browser back button after logout.</p>