Re: Authentication using Apache
| From: | Richard Lynch | Date: | Sat, 16 Dec 2000 22:31:26 +0000 |
| Subject: | Re: Authentication using Apache | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30687@lists.php.net to get a copy of this message | ||
Use telnet to surf to the working TIFFs/PDFs (without the .htaccess and with
Location header).
See if there are any other headers being sent by the server, and send those
to make it work.
I'm guesssing Content-Length and/or disposition or... Who knows what IE
might be wanting...
----- Original Message -----
From: "Steve Harries" <steve_harries@jsh.com.au>
Newsgroups: php.general
Sent: Friday, December 15, 2000 8:37 PM
Subject: [PHP] Authentication using Apache
> I have a directory of image files (.tif's), and pdf's that I want
> to protect from general access but authenticate and retrieve using php.
>
> I've developed authentication code that works fine and I'm
> using a .htaccess file in the directory with
>
> order allow, deny
> deny from all
>
> to restrict access to the images.
>
> My php code is
>
> // completed authetication
> // retrieving images
> // for tiff files
> header ("Content-Type: image/tiff")
> readfile($file);
>
> // for pdf's
> header ("Content-Type application/pdf")
> readfile($file);
>
> // gifs
> header ("Content-type image/gif");
> readfile($file);
>
> My environment is:
> Apache 1.3.12 on RH Linux 6.2
> php 4.0.2 as a Apache module
> IE 5 on Windows 98 as a client.
>
> I've found that this does not work for tiff and pdf files but works fine
> for gifs, in other words it works on the IE built in types but not the
> plug-ins where the browser has to start a helper app.
> I can change the call to get images to;
>
> header ("Location: ".$file);
>
> and all file types work fine. Unfortunately this means I have to
> break my .htaccess restrictions.
> So I really have two questions here, either does anyone know why
> my readfile() doesn't work or, failing that can someone give me
> some advice on the best way to secure my images directory
> using apache and php authetication?
>
> Cheers,
>
> Steve.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>