note 20488 rejected from ref.session by torben
| From: | torben@php.net | Date: | Fri, 05 Apr 2002 11:27:22 +0000 |
| Subject: | note 20488 rejected from ref.session by torben | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-28655@lists.php.net to get a copy of this message | ||
I wanted to be able to register session_vars from mainprogram AND functions without regard to
track_var/register_globals settings or php_version, in order to write code I can always reuse! I
believe to have accomplished this through the following function:
function save2session($var_name, $value)
{
global $$var_name;
global $HTTP_SESSION_VARS;
session_register("$var_name");
$$var_name=$value;
$HTTP_SESSION_VARS["$var_name"]=$value;
}
So if I want ro register an emailadres i use:
save2session('emailadres','joop@joop.nl');
I ONLY use HTTP_SESSION_VARS to readout the vars.. I'd like to hear if anyone disagrees. It
mixes a couple of methods, but it works for me!
peace!