Home > Backend Development > PHP Tutorial > The wonderful use of php include to achieve path encryption_PHP tutorial

The wonderful use of php include to achieve path encryption_PHP tutorial

WBOY
Release: 2016-07-21 15:50:40
Original
917 people have browsed it

1. Transfer program include.inc

Copy code 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 by url address GET
if(!empty($_POST['path'])){ //Get the variable passed by POST
$path = $_POST['path' ];
$path = isBase::decrypt(urlDecode($path));
}
//Resolve the real path
if(empty($path)){
//header ("Location: login.php");
exit;
}
if(!preg_match("/(^http:/)|([?|&|=])/",$path )){
//Jump to the path of the actual executed file
chdir(dirname($path));
include_once basename($path);
exit;
}
?>

index.php is in the same directory as include.inc
Copy the code The code is as follows:

include include.inc;
?>

2. Modify the link in the program ()
Copy code The code is as follows:

"index.php?".encrypt("path=/test/test.php&test=123&test2=4321")

3. Modify the POST form in the program
Form is submitted to index.php
Add a hidden form in the middle

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

5. Encryption and decryption Function, friends, write it yourself.

Summary:
Using this method is more cumbersome and can only hide the path of the background script. The path of the front-end script can still be seen in the source file (baseref) and can be seen on the address bar The addresses are all index.php?xxxxxxxx

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319359.htmlTechArticle1. Transfer program include.inc. Copy the code as follows: ? include_once 'include/Base.php'; $path = ''; $url = isBase::decrypt(urlDecode($_SERVER['QUERY_STRING'])); parse_str($url);...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template