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...
I tried php 4.3.1 and 4.3.7 with apache 2.0.45 both the same. On a Windows box the same program runs fine.
Can anybody help?
_________________________________________________________________________ Frank Rust, Technische Universität, Institut für Theoretische Informatik Tel.: +49 531 391 9525 Postfach 3329, D-38023 Braunschweig Fax.: +49 531 391 9529 Mühlenpfordtstr. 22-23, D-38106 Braunschweig
You ought to make sure that the session was already started before trying to work with it.
Either start the session implicitly via session.auto_start = 1 in your
php.ini so a session is always started automatically or explicitly start it via session_start().
As long as the session is not started the session-array ($_SESSION, HTTP_SESSION_VARS) is not set.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php