Re: session_is_registered gets session values only after doing some output first !?
| From: | Jason Barnett | Date: | Wed, 23 Jun 2004 12:41:34 +0000 |
| Subject: | Re: session_is_registered gets session values only after doing some output first !? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-188864@lists.php.net to get a copy of this message | ||
Frank Rust wrote:
I try to check if a session is registered. This works fine if I first do some output echo "abc"; if (!session_is_registered('userid')) { do_something(); } else { redirect_to_somewhere(); } and I can't redirect to another page ... If I comment out the echo statement I get always false and $_SESSION is empty, but I could redirect somewhere...If memory serves, you shouldn't use the $_SESSION variables in the same script that will use session_is_registered. I just checked the online documentation and yep, that's the case. Are you trying to see if a session has been started? See this: http://www.php.net/manual/en/function.session-start.php Jason