View Full Version : Resolved HTTP protecteded folders and php

Feb 2nd, 2010, 04: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? :)


Feb 2nd, 2010, 04: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:

Feb 2nd, 2010, 05: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? :)

Feb 2nd, 2010, 05: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.

Feb 2nd, 2010, 05:27 PM
Arh okay yea I get it :) got something working now so thank you very much :)