Below is my code for login and session variables. From the login.php page the user password is POSTED to signing_in.php where they are verified and a session created. I can display the values successfully here. At the menu.php page I have code to detect the session but no luck. the session is not available, and returns me back to login. My php.ini is enabled for session support. I am using PHP 4.2.3 and Dreamweavermx with Mysql. I have tried various ways of creating sessions $HTTP_POST_VARS, $_SESSION, session_register etc....... It makes me think there is a setting in php.ini or the like that is incorrect, i have tried changing many of them.
// Signing_in.php //
<?php // from loginn page //
session_start();
// getStatus returns status = admin or staff //
$status = getStatus($HTTP_POST_VARS); // from login form
if($status == "Admin" || $status == "Staff"){
session_register("status");
header("Location: menu.php");
exit();
}else{
/ redirect back to login page if not authorised /
header("Location:login.php");
exit();
}
?>
// menu.php //
<?php
session_start();
if (!session_is_registered("status")) {
header("Location: login.php");
}else{
echo '<p>I am in session</p>';
}
?>