I have a kind of old script for polls that I heavily modified it during years. The main code still there.
Today i realize that is using register_globals On (tested new changes in a local xampp installation).
Is there any good information regarding register_globals On|Off around to share?
I need to prepare this script to register_globals Off but I don't know where to start.
Any help is really appreciated.
You just need to make sure to get your values from the superglobal arrays ($_GET & $_POST) instead of assuming they will be set for you.
The best solution is as Mindzai suggests: to ensure that your script explicitly gets external values from the applicable super-global arrays ($_POST, $_GET, or $_COOKIE). If you need a quik work-around to make something run that depends on register_globals until you can re-factor it, you can use the import_request_variables() function at the start of your script.
You need to check whether your hosting provider has turned register globals off or on. You can use phpinfo to test that.
If it is off, most hosting providers allow custom turning off/on of register globals based on a .htaccess file or php.ini file in the directory.
You can use this interim solution till you change your script.
Last edited by chrisranjana; 08-03-2009 at 08:02 PM.
Well, first ... thank you for your answers.
I tried what you recommend but I still have this problem:
I found at least one variable that is passed along scripts: it's $login. Is set via a post in the Auth class from the "PHP Anthology" book 1st. Ed.
I use this variable some place else to identify the user logged in but I don't see how this variable is passed from the class to the other script. Is this what register_globals is about?
Basically the $login var is assigned:
and in some point this is used as:
With register_globals On is working but with Off is not.
<?php echo "<p>Bienvenido(a) $login<br/><br />"; ?>
I am sure there are more variables just like this one, but I don't see how _GET or _POST are involved here. I dump those variables and get nothing:
Thanks in advance
Maybe. My problem is to figure out how many variables are in this case.
It just happened to found this one.
Last edited by notuo; 08-04-2009 at 03:32 PM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)