Jump to content

set a limit on number of downloaded mp3?


headcutter

Recommended Posts

For bandwidth reasons I want to limit people on my website to download let's say 10,000 mp3's per month since I don't want mp's transfers to consume my bandwidth. I am sure there is a way to do it, but I am quite lost. Are there any scripts which are available for the pubic that would do so? Any help will be appreciated.
Link to comment
https://forums.phpfreaks.com/topic/21963-set-a-limit-on-number-of-downloaded-mp3/
Share on other sites

Why not have a counter running, and just use a conditional statement to tell if the mp3's should be displayed or not.

[code=php:0]
$sql = "SELECT max, count FROM downloads";
$query = mysql_query($sql);
$result = mysql_fetch_row($query);
if ($result['count'] >= $result['max']){
  echo "Sorry, reached maximum number of downloads this month\n";
}
else {
  //echo your page contents here
}
[/code]

This is just thrown together, but should gie you an idea.

Regards
Huggie

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.