$PHP_SELF = str_replace ($SCRIPT_NAME, "", $PHP_SELF); does not fix the problem for me.
I've tried to write a script that explodes the SCRIPT_NAME to return directory names as array entries....
e.g. on the page:
http://mydomain.com/forum/read.html
This function returns very erronous results:
function drawNav(){
global $root, $SCRIPT_NAME,$PHP_SELF;
$link = explode("/", $SCRIPT_NAME);
$subDir = "";
for ($i = 0; $i < count($link); $i++){
echo "<BR>link[$i] = ".$link[$i];
$subDir .= $link[$i]."/";
echo '<BR>dir = '.$subDir.$link[$i]."<BR>";
$d = dir($subDir.$link[$i]);
echo "Handle: ".$d->handle."<br>\n";
echo "Path: ".$d->path."<br>\n";
while($entry=$d->read()) {
echo "<font color=red>".$entry."</font><br>\n";
}
$d->close();
}
$link = explode("/", $SCRIPT_NAME);
The above script is not reading my directories nor thier contents.
Obviously the script is failing unlike the suggestion that the script should work inspite of the seeming error.