Don't try to code the BACK button, instead, use something like this at the head of every page:
if(!isset($_SESSION['login']))header("Location: http://www.example.com/login.php");
Although you could use a relative or even absolute reference with header, I think I read somewhere that you should use the full url. Would cause a problem if testing both locally and remotely though. You could use:
if(!isset($_SESSION['login']))header("Location: {$_SERVER['HTTP_HOST']}/login.php");
to enable the same code to run on local, testing and remote servers
However, I've used absolute references in the past without any ill effects, but I guess some other contributors here could give you good reasons why you shouldn't do this.
diafol
Rhod Gilbert Fan (ardav)
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080