Enabling register globals on Your Site

From OCS Support Wiki

Jump to: navigation, search

[edit] Introduction

On most servers we have register_globals turned off in PHP because it is a security risk. Your scripts should use the $_REQUEST['varname'] method for accessing passed variables, not simply $varname which can lead to SQL injection attacks and other types of problems.

[edit] Temporary Solution

You can enable register_globals on your site by creating an .htaccess file with the following contents (or append this to an existing .htaccess file):

php_flag register_globals on

The .htaccess file needs to be only on the folder that has the PHP script that needs this setting. It is strongly recommended NOT to put this in your public_html folder to enable it for your whole site unless your entire site needs this setting.

[edit] Long Term Solution

It is strongly advised to upgrade your PHP script so that it uses the modern methods to access GET/POST variables.