RE: [PHP] How Do You Protect Individual Files
| From: | David Robley | Date: | Fri, 23 Aug 2002 05:51:03 +0000 |
| Subject: | RE: [PHP] How Do You Protect Individual Files | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-113715@lists.php.net to get a copy of this message | ||
In article <NDBBJIHLJGGJEBMGGKCDIEIBCLAA.re.lewis@attbi.com>,
re.lewis@attbi.com says...
>
>
> Justin French wrote
> On Thursday, August 22, 2002 10:32 AM
>
> > Let us know how you go, and feel free to ask specific problems as you dig
> > through the Zend article, which is pretty much all you need.
>
> Good News! It's working
>
> Bad News. It's not working right.
>
> I pretty much followed the Zend article.
> 1. My main web site is at /home/sites/home/users/demo/web
> 2. I have a document site at /home/sites/home/users/demodocs/web
> 3. I created a directory of files called "/docs/ProjDocs/", and put it
> outside the web root of my document site at ../demodocs/docs/ProjDocs/.
> 4. I created a file called "getdir.php" which reads "docs/ProjDocs/", lists
> the files therein, creates a link to each file, and then redirects to the
> file "getdocfiles.php" after clicking a link.
> 5. I created a file called "getdocfiles.php" which opens and downloads the
> linked file. "getdocfiles.php defines the mime types of all the files I
> wish to download.
> 6. I created the headers exactly per the Zend article.
> 7. I uploaded both "getdir.php" and "getdocfile.php" to ../demo/web
> 8. Calling "getdir.php" displays my file list correctly.
> 9. Clicking on a link gives the following error messages and downloads the
> file to the browser in binary (or something ??)
>
> Can you help me to understand these error messages. I have experimented
> with omitting the headers. The results is that I don't get the error
> messages and continue to receive the file in binary.
>
> (NOTE: I get warnings for lines 70, 71, 73, and 74 when trying to open gif
> or pdf files
> I get warnings for lines 65, 73, and 74 when trying to open other files.)
>
> Warning: Cannot add header information - headers already sent by (output
> started at /home/sites/home/users/demo/web/getdocfile.php:14) in
> /home/sites/home/users/demo/web/getdocfile.php on line 65
This must be the second most FAQ - the clue is at line 14. You can not
output _ANYTHING_ before a header call, not even a space or newline. Check
around line 14 for something outside php tags.
--
David Robley
Temporary Kiwi!
Quod subigo farinam