Re: $HTTP_SESSION_VARS vs $_SESSION - cont.

From: Date: Tue, 13 Aug 2002 14:26:22 +0000
Subject: Re: $HTTP_SESSION_VARS vs $_SESSION - cont.
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-112324@lists.php.net to get a copy of this message
Petre: On Tue, Aug 13, 2002 at 03:18:42PM +0200, Petre Agenbag wrote: > > I have register_golbals = on, BUT, I want to find a way to code that I > know will always work, regardless of register_globals or cookies, so > that I am only dependant on the trans-sid ( but If I could rule that out > too, it would be even better) This example assumes the machine is running PHP >= 4.1.0 allowing use of $_SESSION rather than $HTTP_SESSION_VARS. Adjust as needed. session_start(); if ( !isset($SessionID) ) { # This likely means that register globals is off. # So, loop through the session vars and create regular vars. while ( list($Key, $Val) = each($_SESSION) ) { $$Key = $Val; } } Enjoy, --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

« previous php.general (#112324) next »