PHP Tutorial-php Tutorial

Source: Internet
Author: User
Use phpinclude to implement path encryption. 1. the code for copying the include. inc intermediate program is as follows :? Include_onceincludeBase.php; $ path; $ urlisBase: decrypt (urlDecode ($ _ SERVER [QUERY_STRING]); parse_str ($ url ); 1. Intermediate program include. inc

The code is as follows:


Include_once 'include/Base. php ';
$ Path = '';
$ Url = isBase: decrypt (urlDecode ($ _ SERVER ['query _ string']);
Parse_str ($ url); // GET the variable passed through the url address GET
If (! Empty ($ _ POST ['path']) {// Get the variable passed by POST
$ Path = $ _ POST ['path'];
$ Path = isBase: decrypt (urlDecode ($ path ));
}
// Parse the actual path
If (empty ($ path )){
// Header ("Location: login. php ");
Exit;
}
If (! Preg_match ("/(^ http: \/) | ([? | & | =])/", $ Path )){
// Jump to the path of the actual execution file
Chdir (dirname ($ path ));
Include_once basename ($ path );
Exit;
}
?>


Index. php and include. inc are in the same directory

The code is as follows:


Include. inc;
?>


2. modify links in a program ()

The code is as follows:


"Index. php? ". Encrypt (" path =/test. php & test = 123 & test2 = 4321 ")


3. modify the POST form in the program
All forms are submitted to index. php.
Add a hidden form in the middle

4. modify the path of the front-end Html page
Baseref =/test

5. write the encryption and decryption functions on your own.

Summary:
This method is cumbersome and can only hide the background script path. the front-end script path can still be seen in the source file (baseref). The address displayed in the address bar is index. php? Xxxxxxxx

The pipeline code is as follows :? Include_once 'include/Base. php '; $ path = ''; $ url = isBase: decrypt (urlDecode ($ _ SERVER ['query _ string']); parse_str ($ url );...

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.