re. PHP sessions & headers

From: Date: Wed, 20 Dec 2000 20:57:40 +0000
Subject: re. PHP sessions & headers
Groups: php.general 
Request: Send a blank email to php-general+get-31313@lists.php.net to get a copy of this message
I believe what you're looking for is inherent. Test by writing a script like so: <? session_start(); echo session_id(); ?> You'll see the id doesn't change (per settings in PHP.ini, etc, etc) >From http://www.zend.com/manual/ref.session.php "The session support allows you to register arbitrary numbers of variables to be preserved across requests. When a visitor accesses your site, PHP will check automatically (if session.auto_start is set to 1) or on your request (explicitly through session_start() or implicitly through session_register()) whether a specific session id has been sent with the request. If this is the case, the prior saved environment is recreated. " You can use header("Location: ") after session_start(). On the login screen, after validating the user, I use session_register("skey") to register my ID - this is just my way of doing it, though. I have a file called session_header.php that I prepend to every script, other than login.php. It looks into $HTTP_SESSION_VARS and if it finds my unique id for the user (I use $skey) I let them continue, otherwise I send them to a login screen.

« previous php.general (#31313) next »