I wanted to hide the existance of my include files by making them
'invisible': give a 404 error when requested. This worked, but the files
that were including were obviously 404ing too. So I decided to use $PHP_SELF
and check whether the script's PHP_SELF was it's filename, which would mean
that it was being accessed directly, as opposed to being included. I tried
this code:

$string = "include";
$container = "$PHP_SELF";
if(strstr($container,$string)) {
header("HTTP/1.0 404 not found");

at the top of the include files, but it wasn't working. Change the header()
to an echo and test it. It echoed. So it's a problem with the header(). I
tried this:

header("HTTP/1.0 404 Not Found");

and it worked perfectly. Can header() not be in an if loop or something like

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to