跳转到主内容
websoft网络软件专家 - 深耕网络技术,打造实用软件!

instantiationexception php include的妙用,实现路径加密

1、中转程序include.inc

复制代码代码如下:立即学习“PHP免费学习笔记(深入)

”;

include_once 'include/Base.php';$path = '';$url = isBase::decrypt(urlDecode($_SERVER['QUERY_STRING']));parse_str($url); //获取通过url地址GET传递过来的变量if(!empty($_POST['path'])){ //获取POST传递过来的变量$path = $_POST['path'];$path = isBase::decrypt(urlDecode($path));}//解析真实路径if(empty($path)){//header("Location: login.php");exit;}if(!preg_match("/(^http:\/)|([?|&|=])/",$path)){//跳转到实际执行文件的路径chdir(dirname($path));include_once basename($path);exit;}?>index.php与include.inc同目录复制代码代码如下:立即学习“PHP免费学习笔记(深入)

”;

include include.inc;?>

2、修改程序中的链接()

复制代码代码如下:立即学习“PHP免费学习笔记(深入)

”;

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

3、修改程序中的POST表单

Form都提交到为 index.php中间加一个隐藏表单4、修改前端Html页面的路径baseref=/test5、加解密函数,朋友们自己动手写吧。总结:用这种方法比较繁琐,只能隐藏后台脚本的路径,前端的脚本路径仍然可以在源文件中看得到(baseref) 在地址栏上看到的地址都是index.php?xxxxxxxx以上就介绍了instantiationexception php include的妙用,实现路径加密,包括了instantiationexception方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

相关文章