Forum Moderators: phranque

Message Too Old, No Replies

Bandwidth usage of downloads ...

         

Encore

12:32 am on Oct 29, 2004 (gmt 0)

10+ Year Member



Hey all,

Is there anyway of setting links to .zip files on my server to go down after using up 5gb for example?

I ask this because although near the end up the month, I don't want files I've just uploaded and displayed on site to use up the 10gb I have left ... and would like to be able to haveit so that after 5gb of bandwidth is used up, the link won't be displayed.

Apart from writing a php script to count the number of times clicked and then don't show the link once being download X times ( which would use up 10gb ) .. is there an easier way?

Thanks.

Encore

7:47 am on Oct 29, 2004 (gmt 0)

10+ Year Member



Anyone able to help with this?

Rosalind

3:10 pm on Oct 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The php counter script might come up against the problem of people finding the link in a cache, or arriving from a direct link on another website. So it may not be 100% accurate. But honestly, I can't think of anything easier than simply incrementing a counter.

Encore

5:55 pm on Oct 29, 2004 (gmt 0)

10+ Year Member



Do you have any links which could help me on this?
Am a noob in the php world and have yet to come across this kind of script ...

Not wanting a download manager or some sort .. just something simple which I could set how much bandiwdth certain downloads use in a day for example.

Rosalind

11:28 pm on Oct 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are plenty of counters at Hotscripts and other places, but they're probably not exactly what you need. I was assuming you knew how to hack together your own script. Put something like this on your display page, after creating the suitable db tables:


<?php

// connect to your database first

$query = "select pagecount from countertable";
$result = mysql_query($query)
or die ("This did not work");

if ($pagecount >= '100') // or any number you like

{echo "Sorry, no download today";}

else {echo "The link for the download goes here";}

?>

Then send your downloaders to a page that increments the counter. You'll also need a script to reset the counter, for your admin page.