A
Anonymous
Guest
The server I'm on has session.auto_start turned off. It's php version 4.3.11.
I'm writing a login routine. From what I read at php.net, it seems like you shouldn't use session_register() with session_start(). I'm stumped. If I use session_register(), this works fine (the header location redirects perfectly):
But if I remove the session_register and simply define the session variables, the script fails. I don't get any warnings or error messages, I just get shown the same login page again (the header: location doesn't work even though the login was correct). This fails:
Can anyone tell me what I'm doing wrong?
Is it bad to use session_start() an d session_register() together?
-------
Here's one other oddity with the script. No where in the script does it say "login.php" but if my file loginPP4.php fails (like the second example), the script will sometimes redirect to login.php, not to the original script loginPP4.php. The form on the page says:
When I look at the code, loginPP4.php's form has the correct action:
Why does it return to the wrong page?
I'm writing a login routine. From what I read at php.net, it seems like you shouldn't use session_register() with session_start(). I'm stumped. If I use session_register(), this works fine (the header location redirects perfectly):
Code:
session_start(); // nearly at the top of the script
....
if ($dataValid)
{
session_register("SESSION");
session_register('adminUsername');
session_register('adminClass');
header("location: adminTaskSelect.php");
exit;
}
....
But if I remove the session_register and simply define the session variables, the script fails. I don't get any warnings or error messages, I just get shown the same login page again (the header: location doesn't work even though the login was correct). This fails:
Code:
session_start(); // nearly at the top of the script
....
if ($dataValid)
{
$_SESSION['adminUsername'] = $_POST['username'];
$_SESSION['adminClass'] = $adminClass;
header("location: adminTaskSelect.php");
exit;
}
....
Can anyone tell me what I'm doing wrong?
Is it bad to use session_start() an d session_register() together?
-------
Here's one other oddity with the script. No where in the script does it say "login.php" but if my file loginPP4.php fails (like the second example), the script will sometimes redirect to login.php, not to the original script loginPP4.php. The form on the page says:
Code:
<form name="loginForm" method="post" action="<?=$_SERVER['PHP_SELF'] ?>" id="loginForm">
Code:
<form name="loginForm" method="post" action="/scripts/loginPP4.php" id="loginForm">
Why does it return to the wrong page?