|
Posted by lorento on 02/08/07 04:03
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");
----
http://www.mastervb.net/phpbooks -- recommended php books
http://ascii.mastervb.net -- ascii art generator
On Feb 8, 3:02 am, "devospice" <s...@suddendeath.org> wrote:
> Hi,
>
> I'm trying to create a download counter for individual files on a web
> site and I'm not sure how to do this. Right now I'm using Webalizer
> to just read the log files and see how many times the files I'm
> interested in were downloaded. The problem is Webalizer breaks it up
> by month and I want a running total. I'd also like to see the counts
> without having to log in to Webalizer in the first place. Not that
> logging in or adding the results is too difficult, but it would be
> nice if I could just put a little number on the web site so when I go
> to the site I can imediately see the download counts.
>
> The first thing I thought of was accessing the log files via PHP and
> reading the data out of there. However because the log files get
> broken up, zipped, and a new one started after they reach a certain
> size I'm afraid this will be too complicated and may put too much
> extra strain on the server if this is done too often.
>
> Also, what's the best way to read log files with PHP anyway?
>
> Any ideas?
>
> Thanks.
>
> ->Later.....Spice
Navigation:
[Reply to this message]
|