Hey,
I'm new at using sessions and I've seem to run into a little problem.
After I authenticate, I set the session variables:
session_start();
$_SESSION['sid'] = session_id();
$_SESSION['ip'] = (getenv(HTTP_X_FORWARDED_FOR))
? getenv(HTTP_X_FORWARDED_FOR)
: getenv(REMOTE_ADDR);
$_SESSION['user'] = $user;
And then I redirect to another page with the following code:
session_start();
$ip = (getenv(HTTP_X_FORWARDED_FOR))
? getenv(HTTP_X_FORWARDED_FOR)
: getenv(REMOTE_ADDR);
$user = $_SESSION['user'];
if($_SESSION['sid'] !== session_id() || $_SESSION['ip'] !== $ip)
Header("Location: http://site.info/login.php");
Everything works fine. But when I access the same site again, my variable $user is blank so now the rest of the code returns blank results as well...
What to do?
Thanks!