/*
spesific your include folder
author bageer83@yahoo.co.id
20080913
using for minimalize broken include or include from other places
@$incpath=name your spesific folder
@$file=name file on your spesific folder
map folder
root
includefile
header.php
foother.php
mod
aa.php
incbaru
baru.php
this.php
lain.php
*/
function myInclude($file,$incpath=""){
$incpath="includefile/".$incpath."/";
$true_inc_reff=1;
ini_set("include_path",$incpath);
if(file_exists($incpath.$file)&&(!ereg("http://",$incpath))){
include($file);
}else{
$file=str_replace(".php","",$file);
echo "Sorry \"".$file."\" : not exist"."<br>";
}
$true_inc_reff=0;
}
myInclude("header.php"); /*path of haeder.php : includefile/header.php*/
myInclude("mod/aa.php"); /*path of aa.php : includefile/mod/aa.php*/
myInclude("lain.php","../");/*path of lain.php : lain.php*/
myInclude("baru.php","../incbaru");/*path of lain.php : incbaru/baru.php*/
myInclude($_REQUEST['c'].".php",$_REQUEST['s']); /*?s=mod&c=aa : includefile/mod/aa.php*/
myInclude($_REQUEST['c'].".php",$_REQUEST['s']); /*?s=http://localhost/&c=test will failed*/
myInclude("http://localhost/index.php",""); /*will failed*/
myInclude("index.php","http://localhost/"); /*will failed*/
myInclude("foother.php"); /*path of haeder.php : includefile/header.php*/
#aa.php
/*
first time, checking refferer include
if($true_inc_reff==0){die("failed reff");}
*/
?>
bg83
No comments:
Post a Comment