下载柜台? [英] download counter?

查看:54
本文介绍了下载柜台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在尝试为网站上的个别文件创建一个下载计数器

网站我不知道如何去做这个。现在我正在使用Webalizer

来阅读日志文件,看看我感兴趣的文件被下载了多少次。问题是Webalizer按月分解了它b / b
我需要一个运行总计。我还希望看到计数

,而不必首先登录Webalizer。不是那个

登录或添加结果太难了,但是如果我能在网站上放一点点数就好了,那么当我去的时候会很好br />
到网站我可以立即看到下载次数。


我想到的第一件事是通过PHP访问日志文件和

从那里读取数据。但是因为日志文件得到了分解,压缩,并且在它们达到某个

大小之后又开始了一个新的文件我恐怕这太复杂了如果这样做太频繁,那么服务器上的额外压力太大了。


另外,用PHP读取日志文件的最佳方法是什么无论如何?


有什么想法吗?


谢谢。


- >稍后...... ..Spice

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

推荐答案

我认为你可以制作简单的php应用程序来统计下载,

like :

当人们点击 http:// host / download.php?file = xyz.zip

download.php将增加计数器,人们将转发

到文件xyz.zip


这些不是代码而是算法:

1.创建mysql表

创建表计数器(文件名varchar(100) ,counter int);

插入计数器值(''xyz.zip'',0);

2.创建download.php文件:

//增加计数器表

更新计数器设置计数器=计数器+ 1其中文件名如

''
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]''

//转发到文件

header(" location:xyz.zip");


----
http://www.mastervb.net/phpbooks - 推荐的php书籍
http://ascii.mastervb.net - - ascii art generator


2月8日凌晨3:02,devospice < s ... @ suddendeath.orgwrote:
_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.orgwrote:




我正在尝试创建下载网站上各个文件的计数器

网站,我不知道该怎么做。现在我正在使用Webalizer

来阅读日志文件,看看我感兴趣的文件被下载了多少次。问题是Webalizer按月分解了它b / b
我需要一个运行总计。我还希望看到计数

,而不必首先登录Webalizer。不是那个

登录或添加结果太难了,但是如果我能在网站上放一点点数就好了,那么当我去的时候会很好br />
到网站我可以立即看到下载次数。


我想到的第一件事是通过PHP访问日志文件和

从那里读取数据。但是因为日志文件得到了分解,压缩,并且在它们达到某个

大小之后又开始了一个新的文件我恐怕这太复杂了如果这样做太频繁,那么服务器上的额外压力太大了。


另外,用PHP读取日志文件的最佳方法是什么无论如何?


有什么想法吗?


谢谢。


- >稍后...... ..Spice
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



" lorento" < la ********** @yahoo.compísevdiskusníprríspevku

news:11 ******************* **@j27g2000cwj.googlegro ups.com ...
"lorento" <la**********@yahoo.compíse v diskusním príspevku
news:11*********************@j27g2000cwj.googlegro ups.com...

>我认为你可以制作简单的php应用程序来统计下载,

喜欢:

当人们点击 http:// host / download.php?file = xyz.zip

download.php将增加计数器,人们将转发

到文件xyz.zip


这些不是代码而是算法:

1.创建mysql表

创建表计数器(文件名varchar(100) ),counter int);

插入计数器值(''xyz.zip'',0);

2.创建download.php文件:

//增加计数器表

更新计数器设置计数器=计数器+ 1其中文件名如

''
>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
''


这篇关于下载柜台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆