Re: Sessions and register_globals

From: Date: Fri, 05 Oct 2001 20:37:07 +0000
Subject: Re: Sessions and register_globals
References: 1 2 3  Groups: php.dev 
Request: Send a blank email to php-dev+get-67378@lists.php.net to get a copy of this message
Sebastian Bergmann wrote: > As I initially stated, I'm trying this with PHP 4.0.8-dev. The following script works with both register_globals enabled and disabled and PHP 4.0.8. Can't test it right now with pre-4.0.7, but it should work, too. <?php session_register('session'); if (ini_get('register_globals')) { $session = &$GLOBALS['session']; } else { if (function_exists('import_request_variables')) { $session = &$_SESSION['session']; } else { $session = &$HTTP_SESSION_VARS['session']; } } echo $session++; ?> Now, is this the simplest solution possible, to use session variables while not depending on the setting of register_globals? Thanks, Sebastian -- Sebastian Bergmann http://sebastian-bergmann.de/ http://phpOpenTracker.de/ Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/

« previous php.dev (#67378) next »