i usually have the first lines of my files like this:
<?php
session_name("whatever");
session_start();
include 'common/useful_stuff.php';
$uid = chk_user("myaccount.php");
blah blah...
?>
the chk_user() function is defined like:
function chk_user($goto)
{
if (!isset($_SESSION['varname'])){
header("location: login.php?redir=" . $goto);
die();
}
$str = rtrim(my_decrypt($_SESSION['varname']));
if ($str != "keyvalue"){
header("location: login.php?redir=" . $goto);
die();
}
// get decrypted user_id
return my_decrypt($_SESSION['uid']);
}
and i never get the issues ur talking about
hope that helps some