Forum Moderators: coopster
Warning: Cannot modify header information - headers already sent by (output started at /usr/lib/php/inc_test.inc:2) in /our/web/dir/index.php on line 15
... blah blah blah message. I know what the problem is, but I don't. Let me explain.
The following code works WITHOUT the include(); Once the include is ... well .. included, I get the warning. I know my include works, I have tested it in other scipts. the <?php is all the way at the top like it should be with no trailing spaces etc.
So now that I know that my include is causing this error, I need to know what about my include is so negative. In other words "why?".
[b]index.php -->[/b]
<?php
session_start();
include('inc_test.inc');
if (!isset($_SERVER['PHP_AUTH_USER']))
{
header('WWW-Authenticate: Basic realm=\"Advertisers\"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
}
else if (isset($_SERVER['PHP_AUTH_USER']))
{
if (($_SERVER['PHP_AUTH_USER']!= "admin") ¦¦ ($_SERVER['PHP_AUTH_PW']!= $pass)) [b]// Line 15 [/b]
{
header('WWW-Authenticate: Basic realm="Advertisers"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
}
}
?>
[b]inc_test.inc -->[/b]
<?php
$MyArray[] = "element1";
$MyArray[] = "element2";
$MyArray[] = "element3";
$MyArray[] = "element4";
print "Testing ... I have been included!";
?>
Thanks ...
-- Zak