Could I get some help as to why session variable information is not being passed?
This is just a simple log in script that I’ve used dozens of times, but I’m working with a new hosting server and things are being jacked up.
After I’ve checked the db for user info (login and password) I start my session and create a session variable to tell my authentication script that the user is logged in (setting $_SESSION[‘logged_in’] to true).
session_start();
$_SESSION['logged_in'] = TRUE;
while($row = mysql_fetch_assoc($result))
{
$id = $row['id'];
}
$_SESSION['id'] = $id;
header('Location: /admin');
I’m including this authentication in all my scripts.
session_start();
if($_SESSION['logged_in'] !== TRUE) {
session_destroy();
header('Location: login.php');
}else{
$uID = $_SESSION['id'];
}
ini_set('session.bug_compat_42',0);
ini_set('session.bug_compat_warn',0);
This works fine on my local machine (MAMP). However, on the production server, $_SESSION[‘logged_in’] is not set (or something because it’s not equal to true when I test it).
I should clarify. When testing the login script, the session variable does get set to true. After it forwards to the index page, it’s reset, or lost, or whatever it is that happens to it.
Could I get some help on resolving this please? Thanks in advance.