Re: Sessions, and a Session question
| From: | Chris Adams | Date: | Tue, 11 Jul 2000 17:48:31 +0000 |
| Subject: | Re: Sessions, and a Session question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-5959@lists.php.net to get a copy of this message | ||
> The question i have, is how could i make these variables "Protected" so no
> developer on my site decides that s/he wants to set
> $USER_INFO["userid"] = strtoupper($USER_INFO["userid"])
> Whilst a simple change may not match the db or whatever.
There are two approaches that come to mind. Constants created with define()
cannot be modified or unset later. You could probably modify your code to
look something like:
define("USERID", $USER_INFO['userid']);
(Note the lack of a dollar sign in front of a constant.)
Alternately, you could toss the entire thing into a class and have your
developers call class methods (e.g. getUserID()). If define() works,
however, I can't see why you'd want to use a class.