Subject: Re: [PHP] Re: alternative to protecting files through http auth. From: Jason Wong <[EMAIL PROTECTED]> Date: Sat, 17 Jan 2004 05:08:29 +0800
To: [EMAIL PROTECTED]
On Saturday 17 January 2004 04:03, Scott Taylor wrote:
>Alternately, if you aren't able to create directories or access files >outside the DocumentRoot for your site, you can create an unbrowsable >storage directory protected with a .htaccess file. If the filesystem >permissions are correct, your PHP script will be able to read content
>from that directory, because PHP code isn't subject to .htaccess rules.
It actually does not work.
Could you explain what, exactly, does not work?
I am trying to load a PDF file. I've tried to load it from a protected directory loading it with headers, but this fails if the protection is on. Does this make sense to you?
The above outlines a scheme which is workable. Could you describe the steps you took to implement said scheme which lead you to the conclusion that "It actually does not work" ?
Yes, sorry. Here is the code: $file = 'http://miningstocks.com/protected/archive/Dec03PostPress.pdf'; //now view the PDF file header("Content-Type: application/pdf"); header("Accept-Ranges: bytes"); header("Content-Length: ".filesize($file)); readfile($file); I can send the rest if necessary. You can see the results yourself of this: http://miningstocks.com/enteremail.php (just enter [EMAIL PROTECTED] for an email address). Yet, when I have changed the $file to hold a path that is not protected through http auth. it works perfectly fine and loads the file. Best Regards, Scott
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php