How to count transfered kBytes in File-Download

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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&section=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>>


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux