note 43241 deleted from security.hiding by nlopess
| From: | nlopess@php.net | Date: | Tue, 15 Jun 2004 12:08:51 +0000 |
| Subject: | note 43241 deleted from security.hiding by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71094@lists.php.net to get a copy of this message | ||
Note Submitter: phpnet@vfmedia.de
----
When you want to mask your phpcode and the uri as folders, at first you need the forcetype rule in
http conf (look at my former posting...)
But in my phpcode, I want to work like before (also for Servers where the forcetype directive is not
allowed)
With this little scripts you can change the structure to folder structure( or not this is controlled
by a constant)
define("GET_HIDE",TRUE);//Hide the phpcode or not
define("EXT","");//The extension (nothing when you´ve got forcetype, .php or
other with other extension )
function XcoreGetHandler(){
if(GET_HIDE){
$myhandler = substr($_SERVER['PATH_INFO'],0,-5);
$myhandler = substr($myhandler,1);
$newstring = "";
$newhandler = explode("/",$myhandler);
$count = 1;
foreach($newhandler as $lonehandler){
if($count % 2 != 0){
$newstring .= $lonehandler."=";
}
else{
$newstring .= $lonehandler."/";
}
$count++;
}
$newstring = substr($newstring,0,-1);
foreach ( explode('/',$newstring) as $pair ) {
list($key,$value) = split('=',$pair,2);
$param[$key] = stripslashes($value);
}
return $param;
}
else{
return $_GET;
}
}
function XcoreMakeGet($handler){
$fileinput = str_replace(".php",EXT, $handler);
$fileinput = str_replace("?","/",$fileinput);
$fileinput = str_replace("&","/",$fileinput);
$fileinput = str_replace("=","/",$fileinput);
$fileinput .= ".html";
return $fileinput;
}
$newlink = "sesstest.php?test=1&test2=2&test3=3";
$newlink = XcoreMakeGet($newlink);
echo "<a
href='/".$newlink."'>".$newlink."</a><br>";
$test = XcoreGetHandler();
echo "<br>".$test['test']."<br>";
echo "<br>".$test['test2']."<br>";
echo "<br>".$test['test3']."<br>";