Re: Download files outside DocumentRoot Dir

From: Date: Wed, 27 Sep 2006 22:31:44 +0000
Subject: Re: Download files outside DocumentRoot Dir
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-242322@lists.php.net to get a copy of this message
Richard Lynch wrote: > On Mon, September 25, 2006 3:57 pm, Christopher Weldon wrote: >> On 2:36 pm 09/25/06 "Ramiro Cavalcanti" <ramiro@hostcom.com.br> wrote: >>> Hi Christopher, >>> at first, thank you for your answer. >>> >>> I'd like to know if it's possible use this when php is running like >>> cgi (php-suexec). I've put this code at httpd.conf at <module php>, >>> then tryed to use it at .htaccess, but without successs. >>> >>> Thank you again. >>> >> Oh, in that case, you most definitely can't use the .htaccess >> conditions. >> PHP will have issues if you are running php-suexec. >> >> I'll see if I can think of any other ways around this, but php-suexec >> definitely limits your usage for this simple fix right now. > > If you *want* that ugly HTTP Auth popup box, you can search on php.net > for code to do that. > > If not, you can take that code, and replace the HTTP challenge with a > simple login form. > > If they aren't logged in, the download just doesn't go... > How do you mean? The particular code that I was talking about included doing authentication outside of an ugly HTTP Auth popup box and just including a PHP script that checked that the user was authenticated, and if not, either deny access to him or redirect them to a login page. My proposal requires minimal amount of changes that the user would have to do. He can keep his downloads in the web root and not have to load ANY file into memory. The only PHP side of downloading a file that's in the web root downloads folder is to check for authentication. Thus, a very quick and scalable solution. -- Chris Weldon

« previous php.general (#242322) next »