View Single Post
Old 04-06-2007, 04:28 PM  
pornmasta
Too lazy to set a custom title
 
pornmasta's Avatar
 
Join Date: Jun 2006
Posts: 19,200
in fact i programmed this:

Code:
<?php

$fifi = @$_GET['file'];
$dlimit = 2;
$tlimit = 86400;

if (!$fifi) {echo "error"; exit;};


$sites[1] = array("somewhere", "somewhere");
$sites[2] = array("somewhere", "somewhere");
$sites[3] = array("somewhere", "somewhere");





function dl_file_resume($fi1,$fi2)
{

//$tailleFichier = remote_file_size($fi1);
header('Content-Type: application/octet-stream');
//header("Content-Length: $tailleFichier");
header("Content-Disposition: attachment; filename=\"$fi2\"");
readfile($fi1,$fi2);
}





if (isset($_COOKIE['TimeCookie'])) {
   foreach ($_COOKIE['TimeCookie'] as $name => $value) {


if ($value<$dlimit) { 
     // echo "$name : $value <br />\n";



setcookie("TimeCookie[1]", $value+1, time()+$tlimit);

dl_file_resume($sites[$fifi][0],$sites[$fifi][1]);



}
else {echo "Download limit reached, try again 24 hours after your last download";
exit;
}
   }
}
else {

$value = '1';

setcookie("TimeCookie[1]", $value, time()+$tlimit);  /* expire dans une heure */

dl_file_resume($sites[$fifi][0],$sites[$fifi][1]);

}


?>
pornmasta is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote