Download speedlimit for Guest User

Any hacks and modifications will be in here...

Download speedlimit for Guest User

Postby baipai » Sat Nov 10, 2012 9:31 pm

how make a modification for "download speed limit" in version 2.1.xx ?
i see a solution but is for version 1.xx

must only modify download2.php???????? :?:
baipai
Premium
 
Posts: 18
Joined: Fri Oct 26, 2012 1:07 pm

Re: Download speedlimit for Guest User

Postby SamEA » Wed Nov 14, 2012 4:05 pm

Find in ./download2.php:
Code: Select all
   header('Content-type: application/octetstream');
   header('Content-Length: ' . filesize("./storage/".$validdownload[0]));
   header('Content-Disposition: attachment; filename="'.$validdownload[1].'"');
   readfile("./storage/".$validdownload[0]);
   die();


Replace with:
Code: Select all
$speed_rate = 100;
//Speed is in KB/s (Kilobytes per second).

header('Cache-control: private');
header('Content-type: application/octetstream');
header('Content-Length: ' . filesize("./storage/".$validdownload[0]));
header('Content-Disposition: filename='.$validdownload[1]);

flush();

$dfile = fopen("./storage/".$validdownload[0], "r");

while (!feof($dfile)){
print fread($dfile, round($speed_rate * 1024));
flush();
sleep(1);
}

fclose($dfile);
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm

Re: Download speedlimit for Guest User

Postby SamEA » Wed Nov 14, 2012 4:07 pm

If you have multiple servers on DFH, you will have to apply the above to the addition server's ./multiserver/download.php file.

Let me know if you encounter any issues.
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm

Re: Download speedlimit for Guest User

Postby baipai » Fri Nov 16, 2012 8:51 pm

thanks SamEA

I had already found.
the following problem.
if a download is running, it blocked the whole server.
I think there are major performance problem if 10 downloads simultaneously

do not have another solution?
baipai
Premium
 
Posts: 18
Joined: Fri Oct 26, 2012 1:07 pm

Re: Download speedlimit for Guest User

Postby SamEA » Sun Nov 18, 2012 5:57 am

Yes, as mentioned in the previous post, I'm afraid this modification may use more of the computer's resources than normal.

I do not believe there is another solution, unless it involves modifying the apache's config files. However, you may search on Google for further solutions on how to modify download speeds with PHP, and if you find anything, I'll happily look into it.

Thank you.
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm

Re: Download speedlimit for Guest User

Postby baipai » Sun Nov 18, 2012 10:12 am

Thanks,
I'll look further and report if I find a solution
depositfiles and rapidshare can do, then we can do too.
I am confident.... This is a Great Script
baipai
Premium
 
Posts: 18
Joined: Fri Oct 26, 2012 1:07 pm


Return to Hacks and Modifications

Who is online

Users browsing this forum: No registered users and 1 guest

cron