What happens is if the user logs in correctly it sets his/her username as $session_valid_user.
This is how I start my sessions every page
//clear session variables
$session_valid_user="";
$session_sessid="";
session_name("user_session");
session_start("");
if ($session_valid_user) {
$login_status = 1;
} else {
$login_status = 2;
}
then I call this function
function check_login_status ($login_status) {
if ($login_status!=1) {
header("Location:index.php");
}
}
It's only when users click on the message board part of the website that this doesn't work. And even then it works for some of the users. 😕