Where are you echoing the session variable?
You should try echoing it right at the top.
Maybe you're overwriting with $_SESSION['email'] = $email;
Where $email will be empty on the second load of the page.
Try something like...
[php]
if ($_SESSION['email']) {
// session is set, check if valid
} else {
// session not set, ask for login
}
[/php]
Something to note:
sessions are available on the second load, after you set it.
(thats the reason we have it, continuity in a stateless protocol, http)
they dont always work, if cookies are not accepted by the browser, and your php ini only allows 'safe' sessions, where it isn't passed in the url, sessions will fail.
Reputation Points: 457
Solved Threads: 101
Nearly a Posting Virtuoso
Offline 1,250 posts
since Sep 2005