note 43241 added to security.hiding

From: Date: Tue, 15 Jun 2004 10:56:31 +0000
Subject: note 43241 added to security.hiding
Groups: php.notes 
Request: Send a blank email to php-notes+get-71085@lists.php.net to get a copy of this message
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>"; ---- Manual Page -- http://www.php.net/manual/en/security.hiding.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43241 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43241&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43241&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#71085) next »