Forum Moderators: coopster

Message Too Old, No Replies

register_globals problem

         

Sarah Atkinson

5:56 pm on Jun 19, 2006 (gmt 0)

10+ Year Member



I just inherited a site and it uses registared globals. unfortuanlty my host has them disabled. Is there anyway I can fairly easily correct this? like find and replace. I'm thinking no but figured I'd ask.

eelixduppy

6:09 pm on Jun 19, 2006 (gmt 0)



You can set it to on with .htaccess (if your host supports this) however it is recommended that you keep it disabled. More information here [us3.php.net] and here [us3.php.net].

mikesmith76

6:14 pm on Jun 19, 2006 (gmt 0)

10+ Year Member



you could use the extract() function on the superglobal arrays to create all the required variables. However it would be much better from a security perspective to remove the register_globals dependancy from the code

Sarah Atkinson

11:08 pm on Jun 19, 2006 (gmt 0)

10+ Year Member



OK so if I want to fix the registared globals how do I do this. I have never created code with registared globals. how do I find them in the code?

eelixduppy

6:13 pm on Jun 20, 2006 (gmt 0)



>>>how do I find them in the code?
This is going to be difficult, especially if there is a lot of code. I would turn register globals off, and then add error_reporting(E_ALL); to the top of the pages you want to change. Then for each undeclared variable error you get, add the correct prefix(_POST,_GET,_SESSION, etc...). I'm not sure if this method of finding them is the best approach, however it's a little less tedious than looking through the code to see which variables are what. This is why register globals are evil. You can also refer to the links in msg # 2 for more information. Good luck and happy hunting ;)

Sarah Atkinson

3:16 pm on Jun 22, 2006 (gmt 0)

10+ Year Member



ok so if the verriable exsists with Registered_globals it should be able to be called using one of the the prefixes?