Analysis of Some php skills and precautions _ PHP Tutorial

Source: Internet
Author: User
Some php skills and precautions. From the browser, the header (location) is used to jump to another page, but in fact, php will still execute the background code, if the following code has insecure logic, from the browser, the header (location) is used to jump to another page, but in fact, php will still execute the background code, if the following code has insecure logic, then, we directly ignore the conditions set by the developer and continue to execute the following things.
For example:

The code is as follows:


If (true)
{
Header ('Location: http://www.jb51.net ');
}
File_put_contents('test.txt ',' OK ');


In this code, careless programmers will think the header ('Location: http://www.jb51.net '); over, in fact, the background code is still executed, so use header (location) whether it is encapsulated in another function or written directly, we recommend that you add exit () to the end to confirm that the program is suspended.
=== Soap
A "Class 'soapclient' not found" error occurred while running a demo code today. After searching, you need to start the soap service, but in php. no soap is found in Windows Extensions of ini. dll. at first, I thought my php version did not contain this dll. I checked the ext subdirectory under the php installation directory and found that php_soap.dll exists. Simply add extension = php_soap.dll to Windows Extensions and restart apache.
Ssl is not started by default. extension = php_openssl.dll, you can remove it before.

The code is as follows:


Var_dump ($ query); // print the result as text.
$ GLOBALS // save all global variables (only on the current page)
Get_defined_vars () // returns an array composed of all defined variables (including global variables and Super global variables)
Get_defined_constants () // returns an array composed of all defined constants.

Expose header (location) is redirected to another page, but in fact, php will still execute the background code. if there is an insecure logic in the subsequent code, then...

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.