Register_globals directive:
register_globals is an internal PHP parameter that registers the elements of the $_REQUEST as variables. If you pass the value in the form via POST or GET , the value of this input will be automatically available through a variable in the PHP script named in the name of the input field.
In other words, if you submitted a form containing the username text field, the expression ($username === $_POST['username']) at the very beginning of the script will return true .
His fame is due to the fact that he opens up many security holes, especially for people who follow something less than a strict coding style from a security point of view.
Classic example:
if(user_is_admin($user)) { $authorized = true; } if($authorized) { // let them do anything they want }
Now, if you visited this script in a web browser, and there was register_globals on the server, you can simply add ?authorized=1 to the URL and divine mode will be turned on!
The global :
global - the keyword has little to do with register_globals.
Here is an example of its use:
$foo = 'bar'; baz(); function baz() { echo $foo;
Tim Aug 29 '10 at 2:07 2010-08-29 02:07
source share