I have read the php manual that the global variables are recommended to be disabled, that is, to set regester_globales to off and the manual also provides an example to illustrate what will happen if it is not disabled. The example is as follows, however, the GETauth. php? Authorized1 does not know what it is... SyntaxHighlighte
I have read the php manual and said that global variables are recommended to be disabled, that is, set regester_globales to off.
In addition, the manual provides an example to illustrate the problem if you do not turn it off. The example is as follows.
GET auth. php? What does authorized = 1 mean ??? Hope you can help me.
Example of using register_globals = on
// If the user is valid, the value $ authorized = true is assigned.
If (authenticated_user ()){
$ Authorized = true;
}
// Because $ authorized is not initialized to false in advance,
// When register_globals is enabled, it may use GET auth. php? Authorized = 1 to define the variable value
// Anyone can bypass authentication.
If ($ authorized ){
Include "/highly/sensitive/data. php ";
}
?>
When register_globals = on, the above code is dangerous. If it is off, $ authorized cannot be changed through URL request or other methods, which is much better, even though initialization variables are a good programming habit. For example, if $ authorized = false is added before the preceding code is executed, it can be used whether register_globals is on or off, because the user status is initialized to unauthenticated.
From kaituozhe345