Advait
Advait

Reputation: 6241

php application go back and forth with browser previous - next button

I have created one php application. When I login into the system the next page opens. Now, if I click on previous button from browser it comes back to login page and then again I click on Next button from browser it goes again to next page. How can I stop previous-next pages coming thru browser?

Upvotes: 0

Views: 321

Answers (1)

Loko
Loko

Reputation: 6679

Use this:

    if(isset($_SESSION['sessionname'])){
       header("Location: file2.php");
    }

This will make sure that if he remembers the session (So your login) he will automatically go to the 2nd page. So you can't go to the previous page.

Put this on the page which shouldn't be accesible to go to after you login. (like regiser and login)

Upvotes: 1

Related Questions