Bill Cosby is my Father
Posts: 4
28 credits Members referred : 0
« Reply #4 on: Sep 09, 2007, 07:01:50 PM »
wait.. sorry.. i thought u meant what kinda of error is ( like 404, 504). im not getting any errors but the thing is that. http://www.web-development-blog.com/tutorials/limit_file_download.zip, this script allows the web to limit that downloads for certain amount of time before you can download again. and i cant seem to run..
there are two file into that zip link.. .htaccess and dl.php
i dont know how to run it. they said by just modifying the two files and adding them to your main folder would to the trick but it doesnt.
Bill Cosby is my Father
Posts: 4
28 credits Members referred : 0
« Reply #5 on: Sep 09, 2007, 07:41:59 PM »
sweet, it works..... by the way, is there a way i can display how much a user or an IP used their MB?? and or i can reset their bandwidth so they can start playing songs again?
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6557
40174 credits Members referred : 374
sweet, it works..... by the way, is there a way i can display how much a user or an IP used their MB?? and or i can reset their bandwidth so they can start playing songs again?
you need to store the used bandwidth in the same database table and need to change the query a little bit
Total Zero
Posts: 5
30 credits Members referred : 0
« Reply #7 on: Sep 27, 2008, 12:35:59 AM »
hello, sorry for old topic renewal but i need help with something... well the problem is that i would like to make for this script limit for downloads per day or something.... anyone tried yet??? if yes help me please
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 8357
43129 credits Members referred : 3
« Reply #8 on: Sep 27, 2008, 11:19:20 AM »
Delirious this is not that hard to achieved. Just keep a record in your database with the times that every user downloads a file
Total Zero
Posts: 5
30 credits Members referred : 0
« Reply #9 on: Sep 27, 2008, 02:09:00 PM »
Well for me kinda is... i know some php but not that much... i have now database of last downloaded file and if someone download file he can download it again after some time... and it all works by recgonizing ip.... anything more i dont know how to make... can you help me with that maybe?!
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 8357
43129 credits Members referred : 3
« Reply #10 on: Sep 27, 2008, 04:19:08 PM »
You actually need a table that you will hold 2 things: ip and number of downloads.
Each time someone downloads a file you should :
1) Check if this ip downloaded the file more than X times 2) Update the table by adding one to the count of the downoader's ip
I hope this helps, because at the moment I don't have time to write the script for you. If you can't do it, then post an ad here and I am sure someone will make it for you for some money
Total Zero
Posts: 5
30 credits Members referred : 0
« Reply #11 on: Sep 27, 2008, 09:41:55 PM »
Actually i have script already but i want one more function i think its not that hard to make if someone know how to.... limit number of downloads per day... here is the script
dl.php
Code:
<?php // change this value below $cs_conn = mysql_connect('localhost', 'db_user', 'password'); mysql_select_db('db_name', $cs_conn);
mysql_query("CREATE TABLE IF NOT EXISTS `downloaded` ( `filepath` varchar(255) NOT NULL, `ipadres` varchar(15) NOT NULL, `last_access` datetime NOT NULL, UNIQUE KEY `filepath` (`filepath`,`ipadres`), KEY `ipadres` (`ipadres`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
$sql = sprintf("SELECT UNIX_TIMESTAMP(last_access) last_time FROM downloaded WHERE filepath = '%s' AND ipadres = '%s' ORDER BY last_access DESC", $path, $ip); $res = mysql_query($sql); if (mysql_num_rows($res) > 0) { $last_xs = mysql_result($res, 0, 'last_time')+3600; if ($last_xs < time()) { mysql_query(sprintf("REPLACE downloaded SET filepath = '%s', ipadres = '%s', last_access = NOW()", $path, $ip)); $dl = true; } } else { $sql = sprintf("REPLACE downloaded SET filepath = '%s', ipadres = '%s', last_access = NOW()", $path, $ip); mysql_query($sql); $dl = true; }
if ($dl) { $fullPath = $_SERVER['DOCUMENT_ROOT'].$path; if ($fd = fopen ($fullPath, "r")) { $fname = basename($fullPath); header('Content-type: application/octet-stream'); header('Content-Disposition: filename="'.$fname.'"'); header('Content-length: '.filesize($fullPath)); header('Cache-control: private'); while(!feof($fd)) { $buffer = fread($fd, 2048); echo $buffer; } fclose ($fd); exit; } } else { header('HTTP/1.0 503 Service Unavailable'); die('Abort, you reached your download limit for this file.'); } ?>
and htdocss:
Code:
RewriteEngine on RewriteRule (.*)(pdf|zip)$ /files/dl.php [QSA]
Please anyone
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 8357
43129 credits Members referred : 3
« Reply #12 on: Sep 29, 2008, 10:00:57 PM »
Look delirious this is not the way things work. If you need to learn everyone here would be glad to help you. But you want a solution which sounds more of a job.
It is easy to create the script you ask but it requires 30 minutes to 1 hour for someone to write it and that's not free for any developer. I hope you understand what I am saying
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 8357
43129 credits Members referred : 3
« Reply #15 on: Sep 30, 2008, 11:38:05 PM »
Oh my god I can't believe this.....
If I wanted more clients delirious maybe I was posting to freelancer and I wouldn't create a community to learn others how I make money from internet.
Just realize that we - web developers - are real people, using real clothes, eating real food, paying real bills and we do that by programming web sites. It is ok to help someone learn what I know but I am sorry that I can't work for free
Total Zero
Posts: 5
30 credits Members referred : 0
« Reply #16 on: Oct 01, 2008, 02:34:19 PM »
Well as i see there is no other solution and i will have to pay .... i would pay just want to know if any good coder avaliable. Eh maybe i said too much, sory for dirty words
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 8357
43129 credits Members referred : 3
« Reply #17 on: Oct 01, 2008, 02:38:10 PM »
No worries delirious. Just post here exactly what you want and you will find someone to do it for you (there are a few professional developers in this site)