Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- How to register before download?
April 27, 2006, 12:25 pm
rate this thread
the trial version of a software you have to register to get future
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?
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
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.