Re: Re: How to count transfered kBytes in File-Download

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

 



Hello Eric,

Am 2009-01-04 14:33:37, schrieb Eric Butera:
> On Sun, Jan 4, 2009 at 1:39 PM, Michelle Konzack
> <linux4michelle@xxxxxxxxxxxxxxx> wrote:
> > ----[ '/usr/share/tdphp-vserver/includes/02_functions.inc' ]------------
> > function fncPushBinary($type='show', $file, $mime='') {
> > <snip>
> >        $BUFFER=1024;
> >
> >        $HANDLER=fopen($file, r);
> >
> >        $CUR_SIZE=0;
> >        while ( !feof($HANDLER) ) {
> >          $CUR_SIZE+=$BUFFER;
> >          echo fread($HANDLER, $BUFFER);
> >        }
> >        fclose($HANDLER);
> >
> >        fncUserUpdate($user, 'downloads', $file, $CUR_SIZE, $FSIZE);
> >        exit();
> > <snip>
> > }
> >
> > function fncUserUpdate($user, $type, $file, $cur_size, $file_size) {
> >  echo "What The Hell Is Going On Here?\n";
> >  $HANDLER=fopen('/tmp/fncUserUpdate.log', a);
> >  $DATE=date("r");
> >  fwrite($HANDLER, "$DATE       $user   $file   $cur_size       $file_size\n");
> >  fclose($HANDLER);
> > }
> > ------------------------------------------------------------------------

> Maybe a combination of ignore_user_abort & connection_status will get
> you what you need.  This way the user doesn't make the script die, but
> you can keep checking to make sure the connection is active.  If not,
> update that db and exit out.  I've never attempted anything like this,
> so I don't really have any concrete answers for you.

Since I have encountered that fncUserUpdate() is writing the Test-Logfile
(even with wrong value) I  am  now  puzzeling  arround,  because  I  was
thinking, if I am in the loop 

       while ( !feof($HANDLER) ) {
         $CUR_SIZE+=$BUFFER;
         echo fread($HANDLER, $BUFFER);
       }

and the user intreeupt the transfer, the script would never reach

       fncUserUpdate($user, 'downloads', $file, $CUR_SIZE, $FSIZE);

which WAS writing the Test-Logfile while beeing interrupted...

I have checked with phpsysinfo() but there are no settings like 

    ignore_user_abort
and
    connection_status

Not I have replaced the fncUserUpdate() with the original  function  for
the PostgreSQL and MySQL database and it is just executed and the script
run up to the end...  weird!

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