Jump to content


Photo

set a limit on number of downloaded mp3?


  • Please log in to reply
1 reply to this topic

#1 headcutter

headcutter
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 25 September 2006 - 11:21 AM

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.

#2 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 25 September 2006 - 11:34 AM

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

$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
}

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

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users