Hi All,
I have a script which receives a filepath-name from a mod_rewrite. this can be anything from
"" to "/dire/dir2/page.php"
So I parse it, and see what I have, trying to get both the path and the filename seperately. However, if I do this:
$r_page = getvar('p', '', 2);
// retrieve information about the path:
$filedetails = pathinfo($r_page);
if(($filedetails['dirname'] == ".") || ($filedetails['dirname'] == "..") || ($filedetails['dirname'] == "/"))
{
$filedetails['dirname'] = "";
}
If I enter an empty string, the dirname returns "/", which should match the if statement. It doesn't however. In my query still the "/" shows up. I am not completely sure WHAT pathinfo() should return for a directory when only a filename is specified, or only a directory is specified. Where do I go wrong? Can I even use this on virtual paths? Or should I write a parser using an explode() routine?
Cheers,
Jelle