php include的妙用,实现路径加密
更新时间:2008年07月29日 12:49:01 作者:
用这种方法比较繁琐,只能隐藏后台脚本的路径,前端的脚本路径仍然可以在源文件中看得到(baseref) 在地址栏上看到的地址都是index.php?xxxxxxxx
1、中转程序include.inc
<?
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同目录
<?
include include.inc;
?>
2、修改程序中的链接()
"index.php?".encrypt("path=/test/test.php&test=123&test2=4321")
3、修改程序中的POST表单
Form都提交到为 index.php
中间加一个隐藏表单 <hidden name=path value="/test/test.php">
4、修改前端Html页面的路径
baseref=/test
5、加解密函数,朋友们自己动手写吧。
总结:
用这种方法比较繁琐,只能隐藏后台脚本的路径,前端的脚本路径仍然可以在源文件中看得到(baseref) 在地址栏上看到的地址都是index.php?xxxxxxxx
复制代码 代码如下:
<?
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同目录
复制代码 代码如下:
<?
include include.inc;
?>
2、修改程序中的链接()
复制代码 代码如下:
"index.php?".encrypt("path=/test/test.php&test=123&test2=4321")
3、修改程序中的POST表单
Form都提交到为 index.php
中间加一个隐藏表单 <hidden name=path value="/test/test.php">
4、修改前端Html页面的路径
baseref=/test
5、加解密函数,朋友们自己动手写吧。
总结:
用这种方法比较繁琐,只能隐藏后台脚本的路径,前端的脚本路径仍然可以在源文件中看得到(baseref) 在地址栏上看到的地址都是index.php?xxxxxxxx
相关文章
php file_get_contents取文件中数组元素的方法
下面小编就为大家带来一篇php file_get_contents取文件中数组元素的方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧2017-04-04解析php中session的实现原理以及大网站应用应注意的问题
本篇文章是对php中session的实现原理以及大网站应用应注意的问题进行了详细的分析介绍,需要的朋友参考下2013-06-06PHP 优化配置——加速你的VBB,phpwind,Discuz,IPB,MolyX
PHP 优化配置——加速你的VBB,phpwind,Discuz,IPB,MolyX...2007-07-07
最新评论