include的妙用,實現路徑加密
來源:程序員人生 發布時間:2014-03-22 21:40:16 閱讀次數:3799次
1.中轉程序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,中間加一個隱藏表單 <hidden name=path value="/test/test.php">
4.修改前端Html頁面的路徑:baseref=/test
5.加解密函數就由自己提供了
總結:用這種方法比較繁瑣,只能隱藏后臺腳本的路徑,前端的腳本路徑仍然可以在源文件中看得到(baseref),在地址欄上看到的地址都是index.php?xxxxxxxx.
生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈