13, February 2012

HELP::: :( - Limit the number of downloads per client - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Miscellaneous scripts or snippets (Moderator: Olaf)
Topic: HELP::: :( - Limit the number of downloads per client
« previous next »
Pages: [1] Print

Author Topic: HELP::: :( - Limit the number of downloads per client  (Read 2948 times)
Bill Cosby is my Father
*
Posts: 4
28 credits
Members referred : 0


« on: Sep 08, 2007, 05:14:43 am »

Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Sep 08, 2007, 07:34:46 am »

I tried a video link from the second url, works fine.

Whats your error?


Last blog : A new Wordpress theme for our blog
Bill Cosby is my Father
*
Posts: 4
28 credits
Members referred : 0


« Reply #2 on: Sep 08, 2007, 06:03:58 pm »

Error 404
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Sep 09, 2007, 07:38:06 am »

works for me (at least the files I tried to download)

maybe you can describe where the error occurs


Last blog : A new Wordpress theme for our blog
Bill Cosby is my Father
*
Posts: 4
28 credits
Members referred : 0


« Reply #4 on: Sep 09, 2007, 06: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, 06: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: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #6 on: Sep 09, 2007, 06:49:06 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?
you need to store the used bandwidth in the same database table and need to change the query a little bit


Last blog : A new Wordpress theme for our blog
Total Zero
*
Posts: 5
30 credits
Members referred : 0


« Reply #7 on: Sep 26, 2008, 11:35:59 pm »

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: Male
Posts: 5778
46265 credits
Members referred : 3



« Reply #8 on: Sep 27, 2008, 10: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

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Total Zero
*
Posts: 5
30 credits
Members referred : 0


« Reply #9 on: Sep 27, 2008, 01: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: Male
Posts: 5778
46265 credits
Members referred : 3



« Reply #10 on: Sep 27, 2008, 03: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

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Total Zero
*
Posts: 5
30 credits
Members referred : 0


« Reply #11 on: Sep 27, 2008, 08: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;"
);

$path addslashes($_SERVER['REQUEST_URI']);
$ip addslashes($_SERVER['REMOTE_ADDR']);
$dl false;

$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($res0'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($fd2048);
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  Huh
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5778
46265 credits
Members referred : 3



« Reply #12 on: Sep 29, 2008, 09: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 Smiley

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Total Zero
*
Posts: 5
30 credits
Members referred : 0


« Reply #13 on: Sep 29, 2008, 11:10:53 pm »

Eh this is not friendly community, u want me to hire someone....and with that you wont come anywhere... sory for posting
on this forum anyway, cya
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #14 on: Sep 30, 2008, 07:28:44 am »

Eh this is not friendly community, u want me to hire someone....and with that you wont come anywhere... sory for posting
on this forum anyway, cya

this is a friendly community! you got already my code for FREE!


Last blog : A new Wordpress theme for our blog
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5778
46265 credits
Members referred : 3



« Reply #15 on: Sep 30, 2008, 10: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 Wink

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Total Zero
*
Posts: 5
30 credits
Members referred : 0


« Reply #16 on: Oct 01, 2008, 01: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  Grin
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5778
46265 credits
Members referred : 3



« Reply #17 on: Oct 01, 2008, 01: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)

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7078
Tags : Limit the number of downloads per client Help... Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Miscellaneous scripts or snippets (Moderator: Olaf)
Topic: HELP::: :( - Limit the number of downloads per client
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Feb 13, 2012, 09:56:22 am





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.