RE: [phplib] protecting served files/images/mp3.... From: Daniel Bondurant (bondu <email protected>)
Date: 05/22/01

use
Forcetype application/x-httpd-php
to force php on the file, then it will look like a file to the web
browser
then you can have
http://mysite/downloads/mp3/fileid/filename.mp3

in the downloads folder put in a .htaccess file with
Forcetype application/x-httpd-php
mp3 is your script to get the right file based on fileid.
use URI to get fileid and filename.mp3
filename.mp3 is just there to make the browsers happy.

I use this to prevent people from deep linking to files, and also to
require phplib permissions for certian files.

I think this only works with apache

-----Original Message-----
From: Eric Ries [mailto:eric.ries <email protected>]
Sent: Tuesday, May 22, 2001 2:50 PM
To: Arno A. Karner
Cc: phplib <email protected>
Subject: Re: [phplib] protecting served files/images/mp3....

On Tue, 22 May 2001, Arno A. Karner wrote:

> > I'm doing essentially the same thing with gifs stored in a database,
and it
> > works like a charm, and the html is simple:
> >
> > <img src="foo.php">
> >

I once did something similar. I found it best to do something like:

foo.php/filename.gif

that way, the browser can glean information about they file type by
inspectinge the file extension (the browser doesn't know a script is
involved) and you can inspect the PATH_INFO variable in PHP to know
which
file is expected.

Eric

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>