note 15976 added to function.session-start
| From: | meheler at searchbc dot com | Date: | Thu, 11 Oct 2001 00:01:38 +0000 |
| Subject: | note 15976 added to function.session-start | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18802@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;
}
?>
--
http://www.php.net/manual/en/function.session-start.php
http://master.php.net/manage/user-notes.php?action=edit+15976
http://master.php.net/manage/user-notes.php?action=delete+15976
http://master.php.net/manage/user-notes.php?action=reject+15976