Well, i have had this issue for a while, i think it could be something with the server, but im posting here just to check to see if its a coding error. On my website, users log on, but when they log the session is active for only 1 request back to the server, so basically you log on and when you click to go to another page, your logged off. I cant figure out why its doing this. It does the same thing when i use cookies (which i prefer not to use). Heres the code
if(mysql_num_rows($query) > 0) {
session_start();
$_SESSION['user_id'] = $user;
$user_id = $user;
$loggedin = true;
}
else {
$loggedin = false;
}
..
//later in the code
if(isset($loggedin)) {
if($loggedin == true) {
echo "Your Now Logged In As " . $_SESSION["user_id"];
}
else {
echo "Incorrect Username or Password";
}
}
elseif(isset($_SESSION["user_id"])) {
echo "You Are Already Logged In";
}