General PHP3 problem

From: Date: Wed, 08 Nov 2000 21:55:57 +0000
Subject: General PHP3 problem
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-24398@lists.php.net to get a copy of this message
I have created "test01.php3" containing the sample script below. However when I run it the browser displays the following output:- Warning: Cannot add header information - headers already sent by (output started at /home/taylorp/public_html/test01.php3:2) in /home/taylorp/public_html/test01.php3 on line 7 Warning: Cannot add header information - headers already sent by (output started at /home/taylorp/public_html/test01.php3:2) in /home/taylorp/public_html/test01.php3 on line 8 Authorization Required. Can anyone explain what is happening here? Thanks Phil <%php if ( ( !isset( $PHP_AUTH_USER )) || (!isset($PHP_AUTH_PW)) || ( $PHP_AUTH_USER != 'user' ) || ( $PHP_AUTH_PW != 'open' ) ) header( 'WWW-Authenticate: Basic realm="Private"' ); header( 'HTTP/1.0 401 Unauthorized' ); echo 'Authorization Required.'; exit; } else echo ' <HTML> <HEAD> <TITLE>Secret Stuff</TITLE> </HEAD> <BODY> <H1>SECRET!</H1> <P>This is a secret message.</P> </BODY> </HTML> '; } %>

« previous php.general (#24398) next »