Implement path encryption by using include

Source: Internet
Author: User
1 Intermediate program includeinc & lt ;? Include_once & amp; 39; includeBasephp & amp; 39; $ path & amp; 39; & amp; 39; $ urlisBase :: decrypt (urlDecode ($ _ SERVER [& amp; 39; QUERY _

1. Intermediate program include. inc

  1. Include_once 'include/Base. php ';
  2. $ Path = '';
  3. $ Url = isBase: decrypt (urlDecode ($ _ SERVER ['query _ string']);
  4. Parse_str ($ url); // GET the variable passed through the url address GET
  5. If (! Emptyempty ($ _ POST ['path']) {// Get the variable passed by POST
  6. $ Path = $ _ POST ['path'];
  7. $ Path = isBase: decrypt (urlDecode ($ path ));
  8. }
  9. // Parse the actual path
  10. If (emptyempty ($ path )){
  11. // Header ("Location: login. php ");
  12. Exit;
  13. }
  14. If (! Preg_match ("/(^ http:/) | ([? | & | =])/", $ Path )){
  15. // Jump to the path of the actual execution file
  16. Chdir (dirname ($ path ));
  17. Include_once basename ($ path );
  18. Exit;
  19. }
  20. ?>

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

  1. Include. inc;
  2. ?>

2. modify the link in the program ()

  1. "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, and a hidden Form is added in the middle.

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

5. the encryption and decryption functions are provided by you.

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

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.