this works:
echo("</table>");
echo("<br><BR><BR><BR>");
echo("URL file = ");
echo($urlFile);
echo("<BR>");
$urlFile = "" . $_GET['urlFile'];
echo("$get urlfile = ");
echo("*" . $urlFile . "*");
echo("<HR>");
echo ("Current Directory: " . getcwd() . "\n<BR>");
if ($urlFile = "")
{
$urlFile = "index.html";
}
//$fh = fopen("index.html", 'r');
$fh = fopen("index.html", 'r');
$theData = fread($fh, filesize("index.html"));
fclose($fh);
echo $theData;
this does not....
echo("</table>");
echo("<br><BR><BR><BR>");
echo("URL file = ");
echo($urlFile);
echo("<BR>");
$urlFile = "" . $_GET['urlFile'];
echo("$get urlfile = ");
echo("*" . $urlFile . "*");
echo("<HR>");
echo ("Current Directory: " . getcwd() . "\n<BR>");
if ($urlFile = "")
{
$urlFile = "index.html";
}
//$fh = fopen("index.html", 'r');
$fh = fopen($urlFile, 'r');
$theData = fread($fh, filesize($urlFile));
fclose($fh);
echo $theData;
the dubug output is the same:
urlfile = *index.html*
Current Directory: c:\inetpub\wwwroot
the errors it throws are:
[phpBB Debug] PHP Warning: in file C:/inetpub/wwwroot/frametest.php on line 279: fopen(): Filename cannot be empty [phpBB Debug] PHP Warning: in file C:/inetpub/wwwroot/frametest.php on line 280: fread() expects parameter 1 to be resource, boolean given [phpBB Debug] PHP Warning: in file C:/inetpub/wwwroot/frametest.php on line 281: fclose() expects parameter 1 to be resource, boolean given
how can $urlFile be the same in both examples, but not the name of a file in the second example?
i'm using
$urlFile = "" . $_GET['urlFile'];
for the second example. eg: http://www.MYSITE.com/myPHPscript.php?urlFile=index.html