Re: HTML tags in auth.php script

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

 





ThX John...One other question.
I have an images folder and other 25 sub-folders underneath this folder.
Each of this sub-folder  is a web album with it own default index.html
and thumbnails pics in it.
My question is : Is there an easy way of having a folder level access
control to the "IMAGES" folder
and not having to get into each of those 25 index.html files and
including my "auth.php" script in there.
As of now any one can just type my whole URL upto the sub-folder and get
to see my web pics.

Thanks in advance.
NT






|------------->
|(Embedded    |
|image moved  |
|to file:     |
|pic16836.pcx)|
|             |
|------------->
  >--------------------------------------------------------------------|
  |"1LT John W. Holmes" <holmes072000@charter.net>                     |
  |01/10/2003 03:24 PM                                                 |
  >--------------------------------------------------------------------|



Please respond to "1LT John W. Holmes" <holmes072000@charter.net>

To:   Narendra Talele/USINY/ABB@ABB_US01, php-db@lists.php.net
cc:
Subject:  Re:  HTML tags in auth.php script

Security Level:?         Internal



> 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>

Absolutely anything outside of the <?php and ?> tags is considered
output to
the browser. In order to use the header() function, you can't have any
output before the call to header().

If you want to add that text, then add it in where there is already
output
in the file. Add it to the echo for the "Text to send if ... " or where
your
"Hello ... " message is at.

---John Holmes...







-- 
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