0

I used all the process for destroying session.

 header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
 header("Cache-Control: post-check=0, pre-check=0", false);
 header("Pragma: no-cache");
 session_destroy();
 session_unset();
 clearstatcache();

But when i click the back button it show my previous page with session value. I don't know how to solve it. please help me.

NullPoiиteя
  • 56,591
  • 22
  • 125
  • 143

2 Answers2

2

You need to start the session before:

session_start();

see php.net

jmattheis
  • 10,494
  • 11
  • 46
  • 58
1

This is probably a misunderstanding.

When pressing the back button, you are most likely seeing a cached version of the page in the browser. This does not mean that you are still logged in.

Try refreshing the previous page. It should show the login dialog.

If you want to prevent the page from being shown in this way, here is an approach for turning off the browser's caching.

If you actually remain logged in, then something is wrong. In that case, we need to see some code.

Community
  • 1
  • 1
Syed mohamed aladeen
  • 6,507
  • 4
  • 32
  • 59