How to register before download?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I am sure you have seen this in many sites: before letting you download
the trial version of a software you have to register to get future
email announcements.

Is there a PHP script/s that does this already? I imagine it could be
connected to Mailman (but doesn't have to). Another option is to use a
CMS, but is it worth having a CMS just for this?

Any ideas? I don't want to reinvent the wheel if I don't have to.

Re: How to register before download? wrote:

Quoted text here. Click to load it


It is not difficult, so I say: roll your own.

try something like this:
1) put your file somewhere where outside your webdirectory.
2) after registration, set a $_SESSION["candownload"] = "Y";
3) redirect to a downloadscript (download.php)
4) In download.php you check for $_SESSION["candownload"] == "Y", if so,  
open the file for reading (from the place outside webdirectory) in PHP, and  
deliver it.

Beware that you make the scripttimeout in download.php long (or infinite) in  
case somebody has a slow connection.

Of course, PHP (user www-data/nobody/apache/whatever on *nix or user  
IUSR_<machinename> on W$) must have readpermissions on the file.

Erwin Moller

Site Timeline