HTML tags in auth.php script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





PHP   4.2.3
APACHE 1.3.27
Windows  2K

Hello every one. I am still learning how PHP works. Can some one answer
this
for me please.

This piece of code here works fine ONLY without the HTML tags  (The
first line and the last lines in the code).
The moment I add these lines I get the following error:  (By the way I
don't get these errors if I execute this script on UNIX)

Warning: Cannot add header information - headers already sent by (output
      started at c:\phpdev\www\public\auth.php:2) in
      c:\phpdev\www\public\auth.php on line 4

      Warning: Cannot add header information - headers already sent by
      (output started at c:\phpdev\www\public\auth.php:2) in
      c:\phpdev\www\public\auth.php on line 5
      Text to send if user hits Cancel button

Basically what I am trying to do is to add
this line to get a background image for this page "auth.php"  in my
images folder.
<body background=\"../pics/creme_swirl.jpg\"  text=\"green\"
link=\"blue\" alink=\"red\" vlink=\"red\">


<HTML>
<?php
 if (!isset($_SERVER['PHP_AUTH_USER'])) {
   header('WWW-Authenticate: Basic realm="My Realm"');
   header('HTTP/1.0 401 Unauthorized');
   echo 'Text to send if user hits Cancel button';
   exit;
 } else {
   echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
   echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your
password.</p>";
 }
?>
</HTML>




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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux