A header redirect has to be before any output. So once something is printed to the screen or HTML is shown, then the redirect will not work.
mikulucky
Junior Poster in Training
85 posts since Jan 2012
Reputation Points: 41
Solved Threads: 13
Skill Endorsements: 0
Mikulucky, thanks, I know: the six pages that work are the only ones that send anything to screen - the header works fine in them as it is correctly placed.
The one that doesn't is pure PHP, no html (and all pages begin identically anyway, that being the problem).
Have you tired, putting an exit(); after the redirect. This is because sometimes I have noticed that the header is sometimes ignored, unless the presence of and exit(); .
So;
$inactive = 20;
/* check to see if $_SESSION['timeout'] is set */
if(isset($_SESSION['timeout']) )
{
$session_life = time() - $_SESSION['timeout'];
if($session_life > $inactive)
{
session_destroy();
header('Location: logout.html');
exit();
}
}
$_SESSION['timeout'] = time();
mikulucky
Junior Poster in Training
85 posts since Jan 2012
Reputation Points: 41
Solved Threads: 13
Skill Endorsements: 0
No problem, once done, could you mark as solved and give rep as you feel appropriate?
Thanks
mikulucky
Junior Poster in Training
85 posts since Jan 2012
Reputation Points: 41
Solved Threads: 13
Skill Endorsements: 0