Hi All, I'd like to be able to limit my users to 1 or 2 parallel (concurrent) downloads from my site. This is sort of like what rapid share or mega uploads do. Is this done with PHP? Or is this done on the server some how?? Thanks in advance for all your help.
It's partially using complex algorithms, and partially using coding techniques. Rapidshare's technology is basically querying every specific download threshold (let's say every mb you download) and if it stops querying, it'll let you download again. It's pretty simple, but very costly for these services. What I've just mentioned is at a basic level, they have other things that save them more money without querying and to keep speeds of downloads really fast at the same time. But, that's something for you to do.
You can try having it download with a PHP script. The idea would be the person visits the link (download.php?file_id=gdsa9h340nbolcx). The script would log the IP in the database, then it would search the database for the file_id and find the direct link for it. Then, the php script can send a header saying it's a file, and you can "proxy" the file to download from that page without giving out the direct link. If the database contains two of the IP, then it could add a time+1hour to some sort of field in the database. Then when the person goes to download another file, if the database has two records, it can deny it, or if the database has two records and the time limit is up, it will remove the fields and allow the person to download.
apparently using mod_bandwith is in cpanel (if you enable it before compile) is supposed to do this. However even adding the proper directives, it has no effect. i think it might be worthwhile building mod_bw from source (the apache 2.x version of mod_bandwidth) and integrating with cpanel; at least, this is what i'm going to have to learn how to do soon, via trial and error.