Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can i disable the back browser button after user press logout and destroy session?
    text
    copied!<p>I am having trouble with <code>session_destroy()</code>.<br> When the User press <em>Log out</em> it have to destroy the session. I wrote the following code:</p> <p><strong><em>Logout.php</em></strong></p> <pre><code>&lt;?php session_start(); session_destroy(); header("location: LoginViewController.php"); ?&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><strong><em>Login.php</em></strong></p> <pre><code>&lt;?php session_start(); $_SESSION['user']= $_GET['username']; echo '"&lt;div style="background:white; text-align:right"&gt; Login as:'.$_SESSION['user'].'&lt;/div&gt;"'; echo '&lt;a href="Logout.php" style="text-align:right"&gt;Logout&lt;/a&gt;'; </code></pre> <p><strong><em>LoginViewController.php</em></strong></p> <pre><code>&lt;?php header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); $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("location:login.php?username=".$_POST['uname'].""); } else { echo '&lt;script type="text/javascript"&gt;alert("Enter username and password correctly"); window.location.href="LoginViewController.php";&lt;/script&gt;'; } } </code></pre> <p>I don't know why it is working like that.<br> Please help me to find out where i commit mistake.</p> <p>I want to disable that browser back button after logout.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload