View Full Version : Resolved HTTP protecteded folders and php

02-02-2010, 03:46 PM
Hey just want to hear if anyone know if you can like protect a folder where HTTP authentication is required then put files in there and when on a site someone E.g. pays to download something then the php document Auth's and downloads it and how secure would this be? :)


02-02-2010, 03:54 PM
yes, this can be done. lots of sites already do this. simply keep the files outside of the web root, then when some one pays for the download, stream the files to the client with a php function like this:

02-02-2010, 04:07 PM
So basicly I can use info provided at http://php.net/manual/en/features.http-auth.php to authenticate and then call a function to download the file? :)

02-02-2010, 04:10 PM
no, I wouldn't use that. if your selling downloads then you would want to auth them with php/mysql. once payment is complete, trigger the download.

02-02-2010, 04:27 PM
Arh okay yea I get it :) got something working now so thank you very much :)