You are here: Re: download counter? « PHP Programming Language « IT news, forums, messages
Re: download counter?

Posted by Petr Vileta on 02/08/07 13:00

"lorento" <laurente1234@yahoo.com> píse v diskusním príspevku
news:1170907412.690300.77580@j27g2000cwj.googlegroups.com...
>I think you can make simple php application for count the download,
> like:
> when people click http://host/download.php?file=xyz.zip, the
> download.php will increase the counter and the people will forwarded
> into file xyz.zip
>
> these are not the code but the algorithm:
> 1. create mysql table
> create table counter (filename varchar(100), counter int);
> insert into counter values ('xyz.zip', 0);
> 2. create download.php file:
> //increase the counter table
> update counter set counter = counter + 1 where filename like
> '$_GET[file]'
> //forward to file
> header ("location: xyz.zip");
>
Better then redirecting is to read file in php script, send to browser and
write to sql table after a file is complete send.

1. open file
2. read file and send to browser until EOF
3. increase counter in DB

This avoid a situation when user cancel download.
--

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация