Warning: Cannot modify header information - headers already sent by (output started at Z:\home\localhost\www\321.php:1) in Z:\home\localhost\www\321.php on line 17
Warning: Cannot modify header information - headers already sent by (output started at Z:\home\localhost\www\321.php:1) in Z:\home\localhost\www\321.php on line 18
В чем тут может быть проблема? Все верно переписано с книги.
<?php
$username='admin';
$password='letmein';
if (isset($_SERVER['PHP_AUTH_USER']) &&
isset($_SERVER['PHP_AUTH_PW']))
{
if ($_SERVER['PHP_AUTH_USER'] == $username &&
$_SERVER['PHP_AUTH_PW'] == $password)
echo "You are now logged in";
else die("Invalid username or pass");
}
else
{
header('WWW-Authenticate: Basic realm="Restricted Section"');
header('HTML/1.0 401 Unauttorized');
die("Please enter your username and password");
}?>