hi. I'm currently making a kind of sign-in system for an administrator, and i want to use sessions to allow only the logged in administrator to view admin pages. On the login page, i have this code:
$user = strtolower(trim(stripslashes($user)));
$pass = strtolower(trim(stripslashes($pass)));
//start the session
session_start();
session_register("SESSION");
session_register("SESSION_USERNAME");
session_register("SESSION_PASSWORD");
$SESSION_USERNAME = $user;
$SESSION_PASSWORD = $pass;
//redirect to the main admin page
header("Location: admin.php");
where $user and $pass are the variables passed by the login form. Admin.php (the page you are passed to) then has this code within it:
if (!session_is_registered("SESSION")) {
echo "The session is not registered";
exit;
}
I keep getting told that the session is not registered. I have checked the scripts - the header functions and sessions are called before any output and i have checked that sessions are enabled on phpinfo(). Anyone have any ideas what's wrong with it? Thanx.