Introduction to PHP using the Include encrypted path method

Source: Internet
Author: User
    1. Include_once ' include/base.php ';
    2. $path = ";
    3. $url = isbase::d ecrypt (UrlDecode ($_server[' query_string '));
    4. Parse_str ($url); Gets the variable passed over the URL address get
    5. if (!empty ($_post[' path ')) {//Gets the variable passed by POST
    6. $path = $_post[' path '];
    7. $path = isbase::d ecrypt (UrlDecode ($path));
    8. }
    9. Parse the real path
    10. if (empty ($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. ?>
Copy Code

index.php and include.inc the same directory

    1. Include Include.inc;
    2. ?>
Copy Code

2. Modify the link in the program ()

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

3. Modify the Post form form in the program to submit a hidden form to the middle of the index.php

4, modify the front-end HTML page path baseref=/test

5, add decryption function, friends write it by themselves.

  • 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.