hi i have used this code in my website but have a problem with the header parts where is the problem the error is
[code=php]
<?php
$myusername = "myusername ";
$mypassword = "mypassword ";
$areaname = "My Protected Area";
if ($_SERVER ["PHP_AUTH_U SER"] == ""||$_SERVE R ["PHP_AUTH_P W"] == ""||
$_SERVER["PHP_AUTH_U SER"]!= $myusername ||$_SERVER["PHP_AUTH_P W"]!=
$mypassword) {
header ("HTTP/1.0 401 Unauthorized");
header ("WWW-Authenticate: Basic realm =\"$areaname\"" );
echo"<h1>Author ization Required.</h1>";
die();
}
?>
[/code]
ERRORS
Warning: Cannot modify header information - headers already sent by (output started at /home/afusionc/public_html/Auth.php:6) in /home/afusionc/public_html/Auth.php on line 15
Warning: Cannot modify header information - headers already sent by (output started at /home/afusionc/public_html/Auth.php:6) in /home/afusionc/public_html/Auth.php on line 16
please tell me where iam goin wrong
regards
george thanks for all help
[code=php]
<?php
$myusername = "myusername ";
$mypassword = "mypassword ";
$areaname = "My Protected Area";
if ($_SERVER ["PHP_AUTH_U SER"] == ""||$_SERVE R ["PHP_AUTH_P W"] == ""||
$_SERVER["PHP_AUTH_U SER"]!= $myusername ||$_SERVER["PHP_AUTH_P W"]!=
$mypassword) {
header ("HTTP/1.0 401 Unauthorized");
header ("WWW-Authenticate: Basic realm =\"$areaname\"" );
echo"<h1>Author ization Required.</h1>";
die();
}
?>
[/code]
ERRORS
Warning: Cannot modify header information - headers already sent by (output started at /home/afusionc/public_html/Auth.php:6) in /home/afusionc/public_html/Auth.php on line 15
Warning: Cannot modify header information - headers already sent by (output started at /home/afusionc/public_html/Auth.php:6) in /home/afusionc/public_html/Auth.php on line 16
please tell me where iam goin wrong
regards
george thanks for all help
Comment