Re: [PHP-DB] HTML tags in auth.php script

2003-01-10 Thread Steve Cayford
Check out the auto_prepend configuration option here:
http://www.php.net/manual/en/configuration.directives.php

I believe you can do this on a per-directory basis, but haven't tried 
it.

-Steve

On Friday, January 10, 2003, at 02:56  PM, [EMAIL PROTECTED] 
wrote:




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


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




RE: [PHP-DB] HTML tags in auth.php script

2003-01-10 Thread John W. Holmes
You'll have to put something in each of the files you want to protect.
It usually better to use an include() call to the same auth.php file for
each of the files you want to protect.

If you're looking to protect your .jpg or whatever image files, you
can't unless they are outside of the web root or you use an .htaccess
file.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 10, 2003 3:57 PM
> To: 1LT John W. Holmes
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] HTML tags in auth.php script
> 
> 
> 
> 
> 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" <[EMAIL PROTECTED]>
|
>   |01/10/2003 03:24 PM
|
>
>----------------|
> 
> 
> 
> Please respond to "1LT John W. Holmes" <[EMAIL PROTECTED]>
> 
> To:   Narendra Talele/USINY/ABB@ABB_US01, [EMAIL PROTECTED]
> cc:
> Subject:  Re: [PHP-DB] 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.
> >  > link=\"blue\" alink=\"red\" vlink=\"red\">
> >
> >
> > 
> >  >  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 "Hello {$_SERVER['PHP_AUTH_USER']}.";
> >echo "You entered {$_SERVER['PHP_AUTH_PW']} as your
> > password.";
> >  }
> > ?>
> > 
> 
> Absolutely anything outside of the  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




Re: [PHP-DB] HTML tags in auth.php script

2003-01-10 Thread narendra . talele



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" <[EMAIL PROTECTED]> |
  |01/10/2003 03:24 PM |
  >|



Please respond to "1LT John W. Holmes" <[EMAIL PROTECTED]>

To:   Narendra Talele/USINY/ABB@ABB_US01, [EMAIL PROTECTED]
cc:
Subject:  Re: [PHP-DB] 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.
>  link=\"blue\" alink=\"red\" vlink=\"red\">
>
>
> 
>   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 "Hello {$_SERVER['PHP_AUTH_USER']}.";
>echo "You entered {$_SERVER['PHP_AUTH_PW']} as your
> password.";
>  }
> ?>
> 

Absolutely anything outside of the  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


Re: [PHP-DB] HTML tags in auth.php script

2003-01-10 Thread 1LT John W. Holmes
> 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.
>  link=\"blue\" alink=\"red\" vlink=\"red\">
>
>
> 
>   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 "Hello {$_SERVER['PHP_AUTH_USER']}.";
>echo "You entered {$_SERVER['PHP_AUTH_PW']} as your
> password.";
>  }
> ?>
> 

Absolutely anything outside of the  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




[PHP-DB] HTML tags in auth.php script

2003-01-10 Thread narendra . talele



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.




Hello {$_SERVER['PHP_AUTH_USER']}.";
   echo "You entered {$_SERVER['PHP_AUTH_PW']} as your
password.";
 }
?>





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