include的妙用,實(shí)現(xiàn)路徑加密
來源:程序員人生 發(fā)布時(shí)間:2014-03-22 21:40:16 閱讀次數(shù):3789次
1.中轉(zhuǎn)程序include.inc
- <?
- include_once 'include/Base.php';
- $path = '';
- $url = isBase::decrypt(urlDecode($_SERVER['QUERY_STRING']));
- parse_str($url);
- if(!emptyempty($_POST['path'])){
- $path = $_POST['path'];
- $path = isBase::decrypt(urlDecode($path));
- }
-
- if(emptyempty($path)){
-
- 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,中間加一個(gè)隱藏表單 <hidden name=path value="/test/test.php">
4.修改前端Html頁面的路徑:baseref=/test
5.加解密函數(shù)就由自己提供了
總結(jié):用這種方法比較繁瑣,只能隱藏后臺腳本的路徑,前端的腳本路徑仍然可以在源文件中看得到(baseref),在地址欄上看到的地址都是index.php?xxxxxxxx.
生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對您的學(xué)習(xí)有所幫助,可以手機(jī)掃描二維碼進(jìn)行捐贈(zèng)