I was trying to write a some code that would disallow specific users access
to certain pages.  I had thought this would be as simple as looking at
$PHP_AUTH_USER and sending a 401 header if it was a user that shouldn't have
access to that page.

The problem is the HTTP header was not going out.  I tried 404 and 401, and
then I thought perhaps the HTTP authentication was preventing me from
sending the header, so I tried several different headers (all copied and
pasted from the PHP manual) in an unprotected directory.  I also tried both
IE6 and Mozilla to make sure there wasn't a borwser issue.

The header line seems to be completely overlooked as things echoed below the
header were appearing in the original script.

The test scripts in the unprotected directory are all very simple, for
example:

<?php
  header("Status: 404 Not Found");
?>

I have saved three test scripts as both .php and .phps so you can view them.
In addition, I put up an info.php so you can see my entire PHP config in
case that is the problem. (links below).  Also header(Location:) seems to
work without any problems.

So what am I overlooking?

http://www.foxjet.com/info.php
http://www.foxjet.com/test1.php
http://www.foxjet.com/test1.phps
http://www.foxjet.com/test2.php
http://www.foxjet.com/test2.phps
http://www.foxjet.com/test3.php
http://www.foxjet.com/test3.phps

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to