August 08, 2005 Archives

08.08.2005 23:01

PHP fun

Well I have been putting together a site using php has a front end to a shell script. Well it all done and works well accept when I tried to add a little validation and error checking. I wanted to make sure the shell script ran fine and returns a file name (teamnames.html). Well validating that has become a nightmare. Here's my problem: echo $ret; // prints VikingsVChiefs.html
$ext = substr($ret, -5);
echo $ext; // prints html
$name = pathinfo("/var/www/html/dbnfl/$ret");
echo $name['extension'], "\n"; // prints html
if ( $name['extension'] == "html" ) {
echo "String found to have html extension"; }
else { echo "string not found to have html"; } // prints "string not found to have html"
Can you see this strange dilema ?? I have tried several different ways with the syntax, yet always results the same. I will hopefully have the answer to this soon. -----

Posted by DaveQB | Permanent Link | Categories: IT