Register_globals settings _ PHP Tutorial

Source: Internet
Author: User
About register_globals settings. For various reasons, PHP settings must be enabled based on the register_globals parameter, but it also becomes an important security risk. please refer to the following code: remote users can be simplified for a variety of reasons. The PHP setting depends on the register_globals parameter, but it also becomes an important security risk. please refer to the following code: Remote users can simply pass authenticated as form variables. even if the authenticate_user () function returns false, $ authenticated is set to true. This is a simple example. you may say that my program won't be written like this. In fact, in a slightly more complex application, this mechanism will become a major vulnerability. Therefore, for the new version of PHP, we recommend that you do not use this variable to control the application, although we do not intend to delete it in the near future. To help you create an application with register_globals set to off, some variables are added to replace the old ones. The following are seven new arrays: $ _ GET-contains the form variable sent through GET $ _ POST-contains the form variable sent through POST $ _ COOKIE-contains the HTTP cookie variable $ _ SERVER-contains the SERVER side variable (for example: REMOTE_ADDR) $ _ ENV-contains the environment variable $ _ REQUEST-GET variable, the combination of the POST variable and the Cookie variable, and variables that cannot be trusted by users. $ _ SESSION-contains the HTTP variables registered through the SESSION module. these variables are automatically set as global variables in any range and can be called anywhere without the need for a global keyword. For example, function example1 () {print $ _ GET ["name"]; // You do not need to write it as global $ _ GET ;} another tips is to add a record in the $ _ SESSION array to automatically register as a SESSION variable, just as you have called the session_register () function.

The region setting depends on the register_globals parameter, but it also becomes an important security risk. please refer to the following code: remote users can be simplified...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.