Re: [PHP] How do I protect downloadable files?

From: Scott Taylor (scotttaylor_at_bigfoot.com)
Date: 01/09/04


Date: Fri, 09 Jan 2004 07:04:17 GMT


Am I correct in understanding your suggestion:
set up HTTP basic authentication, but store the
username and password for this inside a database.
  retrieved from the database this information
(username and password). check if it matches the
HTTP authentication. If so, start the download.

If this is what you are saying, what would be the
correct headers to use to authenticate?

Best Regards,

Scott Taylor
scotttaylor@bigfoot.com

Larry Brown wrote:
> You could have your authorization info in the mysql db including file
> locations that are stored along with the authorization level necessary to
> download them. If the person is authenticated to download the file, the php
> script uses the file location info from the db to open the file and generate
> the headers necessary to start the download. This way the end user never
> has to have direct access to the download directory and you don't have to
> copy the file into a temporary directory.
>
> Larry
>
> -----Original Message-----
> From: news.php.net [mailto:news.php.net@akwebb.com]
> Sent: Tuesday, December 30, 2003 2:13 PM
> To: php-general@lists.php.net
> Subject: [PHP] How do I protect downloadable files?
>
>
> Hello, I have wrtten a PHP based web site with a MySql backend and now I
> want to password protect downloadable files. I have logon and session
> handling taken care of but I can't figure out how to only allowed those who
> are currently logged in and above a certain security level to access the
> downloadable content and prevent bookmarking of the file location for
> redownloading.
>
> Currently I have a .htaccess file to protect the files but then you need to
> enter a User ID and password a second time. I would prefer a single signon
> solution.
>
> I have considered copying the files to a temporary area each time someone
> wants to download it and then erase it when the session is killed but these
> files can be large (20-100 mb) and I would rather not do all of that copying
> if possible.
>
> Creating unique symlinks would be easier but my development machine is
> Windows and my server is FreeBSD and I can't create file links under
> Windows. Plus, my FreeBSD server is not near me so remote development is
> difficult.
>
> Thanks to anyone with any ideas,
> Andrew
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



Relevant Pages

  • Re: Error message when click save target as .....
    ... I'm trying to download my bank statement from Citibank. ... version has no problem but after installing XP SP2, ... > Internet Explorer was not able to open this Internet Site. ... > connection and client authentication. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: XP Key Authentication disabled Office 2003
    ... I purchased Office 2003 from Best Buy about six months ago. ... This also positive promotes open-source software, such as OpenOffice, where you can download and use the product without worrying about product activation problems. ... Authentication is not manditory, ...
    (microsoft.public.windowsxp.general)
  • Re: Http Help please
    ... > download a file from the web. ... there is a ASP/ASP.NET username and ... enter a user name and password (as opposed to an authentication dialog that ... session ID or cookie or whatever the Web site uses to say "you're logged in" ...
    (microsoft.public.vb.general.discussion)
  • Re: Need to restrict access to an EXE in IIS6
    ... it fails if I have it set to Integrated Windows Authentication. ... I then looked at the Default Web Site using IIS Manager, ... NTFS permissions so it remained downloadable for a short period of time ... download when I go to the web site. ...
    (microsoft.public.inetserver.iis.security)
  • Re: why authentication required downloading from microsoft
    ... when i try to download anything from ... a box appeared and asks me for authentication. ... antivirus program (meaning a version not earlier than 2002 and using ... Although CWShredder is no longer being updated, ...
    (microsoft.public.windowsxp.general)