|
Posted by Morlaath on 08/20/07 00:14
Ok I have a login page that forwards to a php page (loginCheck.php)
which connects to the db verifies the user blah blah. If the user is
not verified the function verifyUser($un, $pw) returns -1, otherwise
0. Also if the user/pass is in the db (user is verified), then session
variables are set e.g. $_SESSION['username'], etc. I save the returned
value from verifyUser and have a check that redirects to the main page
or back to the login page, (success, failure respectively).
this is how I am doing this.
$verified = verifyUser($_POST['user'], $_POST['pass']);
if($verified == 0) {
header("Location: ../index.php");
} else {
header("Location: login.php");
}
pretty simple.......except if the user/pass is good and you are
redirected to the index page all the session variables are gone, as if
the session was destroyed. This sucks because I have a header at the
top of the page which tells you whether you are logged in or not, etc.
But instead I get an error "Undefined variable: _SESSION....". Any
help with this would be greatly appreciated.
[Back to original message]
|