0

Now I want to retain in the same page when I click back button on browser. If there is any possible please guide me. After login if I press back button on browser the page will not go to login page it have to retain/reload into the same page. my program in php.

Konrad Krakowiak
  • 12,285
  • 11
  • 58
  • 45
  • 1
    It would be nice if what you're asking had some content to go along with it – ksealey Jun 18 '15 at 04:28
  • In PHP means header('Location: '.$_SERVER['PHP_SELF']); check it. – Ramki Jun 18 '15 at 04:34
  • check [this one](http://stackoverflow.com/questions/14543245/browser-back-button-handling), maybe suit your need – lucas Jun 18 '15 at 04:35
  • possible duplicate of [Disabling Back button on the browser](http://stackoverflow.com/questions/87422/disabling-back-button-on-the-browser) – Sulthan Allaudeen Jun 18 '15 at 04:38
  • when i use header('Location: '.$_SERVER['PHP_SELF']); it shows The page isn't redirecting properly. how can i come over from this – mageshkumar Jun 18 '15 at 04:46
  • Refer this link: http://stackoverflow.com/questions/19926641/how-to-disable-back-button-in-browser-using-javascript – Deepak Nirala Jun 18 '15 at 04:51
  • After successful login create a session and store status as logged in. In the login page check whether $_SESSION['status'] variable empty or not. if not empty redirect to index page. This won't make you see the login page again after login. And destroy the session in the logout – Sivabalan Jun 18 '15 at 04:53
  • sorry Mr.sivabalan i can't understand will you please explain me briefly – mageshkumar Jun 18 '15 at 05:12

1 Answers1

0

Try This one:

 $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; 
  header("Location: ".$url); 

Or

header('Location: '.$_SERVER['PHP_SELF']);
Ramki
  • 519
  • 2
  • 9