note 15976 deleted from function.session-start by jimw

From: Date: Fri, 07 Dec 2001 20:29:24 +0000
Subject: note 15976 deleted from function.session-start by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-21928@lists.php.net to get a copy of this message
I found a good way to securely use session variables like globals, but with having register_globals set to off: <?php session_start(); foreach($HTTP_SESSION_VARS as $key => $value) { $session_temp[] = $key; $$key = $value; } ?> <html> <head> .. the rest of your page .. </body> </html> <?php // Then you need to restore them, so that they save when the page terminates. foreach ($session_temp as $key => $value) { $HTTP_SESSION_VARS[$value] = $$value; } ?>

« previous php.notes (#21928) next »