How to use the include encryption path in php
- 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
- Include. inc;
- ?>
2. modify links in a program ()
- "Index. php? ". Encrypt (" path =/test. php & test = 123 & test2 = 4321 ")
3. modify the POST Form in the program and submit it to add a hidden Form to index. php. 4. modify the path of the front-end Html page baseref =/test 5. write the encryption and decryption functions on your own. |