Re: protecting downloads with php
| From: | Steve Overall | Date: | Sat, 11 May 2002 16:57:26 +0000 |
| Subject: | Re: protecting downloads with php | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97137@lists.php.net to get a copy of this message | ||
Nick Wilson wrote:
> Does anyone know of somewhere that lists content-type's?
>
> Many thanks :-)
> - --
> Nick Wilson // www.explodingnet.com
>
See http://www.ietf.org/rfc/rfc2183.txt for
handling file types in headers.
Also see the PHP manual http://www.php.net/manual/en/function.header.php
and http://www.php.net/manual/fi/function.fpassthru.php
You can download your own copy of the PHP manual from http://www.php.net/download-docs.php
and a Windows help version from http://weblabor.hu/php-doc-chm/
All the best,
Steve Overall
----- Original Message -----
From: "Nick Wilson" <nick@explodingnet.com>
To: "PHP-General" <php-general@lists.php.net>
Sent: Saturday, May 11, 2002 2:44 AM
Subject: Re: [PHP] protecting downloads with php
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> * and then Miguel Cruz declared....
> > > I use an class to handle all the auth stuff and each page checks the
> > > value of $obj->logged_in :: No problem.
> > >
> > > but what if someone links to www.thesite/theProtectedArea/file.tar.gz
> > >
> > > that file cannot check if the downloader is logged in can it.
> >
> > download.php:
> >
> > <?
> >
> > if (userIsAuthorized)
> > {
> > header('Content-Type: application/x-gzip');
> > readfile('secret-name-of-file.tar.gz');
> > exit;
> > }
> > else
> > {
> > print 'You are not authorized to download this file.';
> > }
> >
> > ?>
>
> Fantastic, so simple!
> Does anyone know of somewhere that lists content-type's?
>
> Many thanks :-)
> - --
> Nick Wilson // www.explodingnet.com
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
>
> iD8DBQE83OgUHpvrrTa6L5oRAkdEAJ4wwvkgfRAXYNqg+Cf4uuwZDz8mOACdE091
> do6OoY5f2HoTiRM3sGGFSeQ=
> =Cirg
> -----END PGP SIGNATURE-----
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>