Re: Switching from "Register_Globals=On"
| From: | Matt | Date: | Sat, 13 Apr 2002 11:53:03 +0000 |
| Subject: | Re: Switching from "Register_Globals=On" | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-92866@lists.php.net to get a copy of this message | ||
> I've read the manual on "Session handling functions", but I must have a
thick
> block on this concept . What should I do now that I want to use
> $HTTP_SESSION_VARS or $_SESSION ? How do I implement it on secondary
pages?
> Will I be facing a major re-write of all my code? [Gulp :>]
Yes.
1. You must use session_start() on every page with sessions because
session_register() won't work with the associative arrays.
2. Every reference to session_register must come out and replaced with the
code to set the session var $_SESSION[]. These two actions are probably at
different places in the script, so remove the reference to session_start,
and at:
3. Every reference in every script to a global session var will need to be
replaced with a reference to $_SESSION['rcity'];
4. You'll also need to change any references to session session_unregister
to unset($_SESSION['rcity']).
Read the notes in the manual, as you can't mix the use of $_SESSION and
session_register(), session_unset(), etc. If you use the arrays, everything
must be done with the arrays.
I'd suspect the reference to undefined function is caused by a typo and
placing a $ in front of a function name such as $session_start().