I'm having trouble getting my authentication system to work, because the session is not persisting, so it continually defaults to the login, each time I hit a new page.
In order to test, I created a very simple 2 page session variable test.
Page 1:
Code: Select all
<?php session_start(); ?>
<?php
ini_set('error_reporting', 8191);
$_SESSION["sessiontracker"] = 1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="robots" content="all" />
<title>session test page 1</title>
</head>
<body>
<?php echo "Session= " . $_SESSION["sessiontracker"] . "<br /><br />"; ?>
<a href="sess_test2.php">Try to display Session Variable on next page</a><br /><br />
</body>
</html>Code: Select all
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="robots" content="all" />
<title>Session test</title>
</head>
<body>
<?php echo "Session= " . $_SESSION["sessiontracker"] . "<br /><br />"; ?>
<a href="sess_test.php">back to sess_test</a><br /><br />
</body>
</html>Session=1
But it's just:
Session=
On the first page, it is appropriately echoing the session variable:
Session=1
What am I doing wrong here?
thanks,
max