Register_Globals workaround for config on or off

how to turn Register_Globals on or off from the config file.

Option 1 – PHP Config File:
First place to look is to open up the php config file on your root server and find the line register_globals and set it to “on” or “off”. Some may want you to set it to “0” or “1”.

Option 2 – php.ini File:
If you do not have access to your php config file (most people using shared servers will not have access), you may be able to us a “php.ini” file on any public directory (like under /public_html/). There you will be able to set register_globals on or off to that directory, including all sub-directories. Once you’ve created the file using the name “php.ini” just type “register_globals = on” in the file and upload that to your server.

Option 3 – .htaccess File:
If the above does not work, just use the .htaccess file and type the following:

#Turn off register_globals
php_value register_globals 0


#Turn on register globals
php_value register_globals 1

If all else fails, just do this at the begining of your code:

$$k=$v; //Yes, that’s two dollar signs

This will set all post data (if you want to use $_GET, just subsatute $_POST to $_GET) as a variable so your code now can read all the data passed to it via Post or Get.

That’s it.

Tagged : / / / / /

2 thoughts on “Register_Globals workaround for config on or off

Leave a Reply

Your email address will not be published. Required fields are marked *