|
You could always store the user's IP and the last date they downloaded something in a database, like this:
IP Date Restricted
1.2.3.4 8/23/04 False
When they download, the code should check to see whether or not their IP is in the database.
If it is in the database, it should check to see if the date of their last download (Date) is today...
If it is today, Restricted should be set to True, and their download should be allowed.
If restricted is already set to true, but the date is not today, the restricted should be set to false, and the date should be set to today, and the user should be allowed.
If the user is not in the database at all, Date should be set to today, and restricted to false.
If you implement that algorithm it should allow 2 downloads per IP per day. The only time this could cause a problem, is if someone is using a Proxy, or NAT and someone using the same proxy or router has already downloaded 2 times. That would lock them out. But either way you're saving bandwidth.
If users aren't anonymous, and have user names you could always store their user name instead of their IP in the database.
|