Code: Select all
if($u_pass == $row[2])
{
session_start();
$_SESSION['ID'] = $row[0];
$_SESSION['username'] = $row[1];
$_SESSION['type'] = $row[3];
$_SESSION['forename'] = $row[4];
$_SESSION['surname'] = $row[5];
if ($row[3] == '1')
{header("location:adw-home.php");}
elseif ($row[3] == '2')
{header("location:nrt-home.php");}
elseif ($row[3] == '3')
{header("location:rst-home.php");}
}
The next section is how all the user type 2 pages start:
Code: Select all
<?php
session_start();
if (isset($_SESSION['username']))
{
$u_ID = $_SESSION['ID'];
$u_name = $_SESSION['username'];
$u_type = $_SESSION['type'];
$u_forename = $_SESSION['forename'];
$u_surname = $_SESSION['surname'];
if($u_type == 2)
{
............... content of the page
}
else echo "Sorry something has gone wrong with your user type, please contact site admin. Thank you.";
}
else echo "You are not logged in. Please <a href=index.html>click here</a> to log in.";
?>
The next section is my logout.php
Code: Select all
<?php
session_start();
unset($_SESSION['ID']);
unset($_SESSION['username']);
unset($_SESSION['type']);
unset($_SESSION['forename']);
unset($_SESSION['surname']);
session_destroy();
header("location:index.php");
?>
However, when I test the log out on a page which includes a form there is a problem in Firefox and Safari:
It takes the user to the index page, appears to destroy the session but if I just press back in the browser it will go back and view the page. It won't let me use the form but I can view it. It even shows the username.
I really am stuck here and don't understand what's going on. Especially as the logout works in chrome and IE6 on all pages.
Does anyone have any ideas?
Thanks,
John.