-4

Can anybody explain me simply with example what happens if register_globals in PHP is set to On or Off? I'll be highly glad. Thank you.

Somadder Abhijit
  • 85
  • 1
  • 3
  • 9
  • 2
    RTFM ? http://php.net/registerglobals and http://nl1.php.net/manual/en/ini.core.php#ini.register-globals It makes variables like `$_GET['foo']`, `$_POST['bar']` and `$_COOKIE['blah']` accessible as `$foo`, `$bar` and `$blah`. It was deprecated, mainly because of security issues that you get with bad coding styles. And now even is removed. – nl-x Jun 01 '14 at 20:43
  • Just leave it off. Turn it off and walk away. Then google it, or search Stackoverflow. – alexis Jun 01 '14 at 20:43

2 Answers2

0

In few php versions register_globals is on by default.This setting tells whether or not to register the contents of the Environment, GET, POST, Cookie, Server variables as global variables. For example, if register_globals is on, the url

http://www.example.net/abc.php?id=3

will declare $id as a global variable. This feature is a security risk, and you should ensure that register_globals is Off for all scripts.

Mirza Sahaib
  • 137
  • 1
  • 2
  • 11
0

Register Globals This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.

Manav
  • 553
  • 7
  • 18