'$l_limit' AND userip = '$userip'");
$rows = $arr[0];
if ($rows == 0) {
mysql_query("INSERT INTO downloaded (fname, fdate, fpath, filesize, userip) VALUES ('$fname', '$fdate', '$fullPath', '$filesize', '$userip')");
$dl = true;
}
else {
$link_downloaded = $rows;
//$link_downloaded = get_num_rows($l);
//$link_downloaded = ($link_downloaded) ? $link_downloaded : 0;
if ($link_downloaded >= intval($dl_limit_perday)) {
print("
Error!
");
print("You have downloaded $link_downloaded/{$dl_limit_perday} links already.
");
}
$dl = false;
}
if ($dl) {
if ($fd = fopen ($fullPath, "r")) {
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.');
}
}
?>