note 12958 deleted from ref.session by sniper

From: Date: Sun, 28 Jul 2002 01:14:02 +0000
Subject: note 12958 deleted from ref.session by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-33798@lists.php.net to get a copy of this message
When register_globals is turned on, changes in $HTTP_SESSION_VARS won't be saved to session. Because I wanted to use $HTTP_SESSION_VARS without turning register_globals off, I wrote that "workaround" function below. It should be called at the end of every PHP script that modifies $HTTP_SESSION_VARS. /* delete the dots before using ;) */ function session_regglobals_workaround() // by Hans Spath { . global $HTTP_SESSION_VARS; . if ( ini_get('register_globals') ) . . foreach ( $HTTP_SESSION_VARS as $varname=>$value ) . . . if ( session_is_registered($varname) ) . . . . $GLOBALS[$varname] = $value; } comments? critics? <postings.php.net at hans-spath.de>

« previous php.notes (#33798) next »