How to count transfered kBytes in File-Download
- From: linux4michelle@xxxxxxxxxxxxxxx (Michelle Konzack)
- Date: Sat, 3 Jan 2009 02:17:44 +0100
Hello *,
currently I have a function:
----[ '/usr/share/tdphp-vserver/includes/02_functions.inc' ]------------
<snip>
function fncPushBinary($type='show', $file, $mime='') {
if ( is_file("$file") ) {
if ($mime == '') {
$mime=exec("file -i -b $file");
}
$STRG="; filename=\"" . basename($file) . "\"";
$FSIZE=filesize("$file");
if ($type == 'show') {
header("Content-Disposition: inline" . $STRG );
} else {
header("Content-Disposition: attachment" . $STRG);
}
header("Content-Type: " . $mime);
$HANDLER=fopen("$file", r);
echo fread($HANDLER, $FSIZE);
fclose($HANDLER);
exit();
} else {
$ERRNO=2;
$ERRTX=sprintf( T_gettext("The requested binary file does not exist.<p>%s"), $file );
fncError($ERRNO, $ERRTX, $ERRPAGE);
}
}
<snip>
------------------------------------------------------------------------
which I want to modify it to count the kBytes a user download and block
after a definde amount...
(there are too many peoples in the world which want to suck anything for
free and unlimited and no one cares who pay the stuff... even if I have
100 TByte free traffic on one of my bigger servers)
My problem is now
1) how to count partial downloads
2) how to allow users to make partial downloads
any suggestions?
Oh, I should note, that the URL's looks like:
/?what=music&where=h§ion=foo&name=I_love_php5.ogg
and the input to the function is already sanitized.
Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
24V Electronic Engineer
Tamay Dogan Network
Debian GNU/Linux Consultant
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
<http://www.tamay-dogan.net/> <http://www.can4linux.org/>
Michelle Konzack Apt. 917 ICQ #328449886
+49/177/9351947 50, rue de Soultz MSN LinuxMichi
+33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)
Attachment:
signature.pgp
Description: Digital signature
- Follow-Ups:
- Re: [PHP] How to count transfered kBytes in File-Download
- From: Jim Lucas
- Re: [PHP] How to count transfered kBytes in File-Download
- Prev by Date: Re: [PHP] IE Problem Detecting Post Variables
- Next by Date: Re: [PHP] IE Problem Detecting Post Variables
- Previous by thread: [PHP] Posting Data?
- Next by thread: Re: [PHP] How to count transfered kBytes in File-Download
- Index(es):
Relevant Pages
|