在我的网站上统计访客 [英] Count visitors on my website

查看:54
本文介绍了在我的网站上统计访客的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我已经看过几个地方 - 该网站列出了当前正在浏览该网站的

人数(未登录)。我怎么能这样用

请用php / mySQL?

解决方案

.. oO(Ciaran)


>我已经看过几个地方了 - 该网站列出了当前正在浏览网站的人数(未登录) 。我怎么能用php / mySQL做这个呢?



你可以使用rand()。


这样的统计数据从来都不准确。 HTTP是一种无状态协议,

没有像当前在线用户这样的东西。用户来了,

发送请求,获得响应并且消失了。下一个请求,下一个用户。


Micha


文章< 6u *********** *********************@4ax.com> ;,

Michael Fesser< ne ***** @ gmx.dewrote:


> .oO(Ciaran)


>>嗨我见过这个一些地方 - 网站列出了当前浏览网站的人数(未登录)。我怎么能用php / mySQL做这个呢?


你可以使用rand()。

这样的统计数据从来都不准确。 HTTP是无状态协议,没有像当前在线用户这样的东西。用户来,
发送请求,得到响应,然后就消失了。下一个请求,下一个用户。



VBulletin软件不仅使用论坛登录了多少用户和

,还列出了他们的名字。


可以合理地假设对于像论坛这样的网站,如果用户

登录,该用户可能仍会在论坛上查看
用户最近一次活动后
分钟。应该很容易

保持一个正在运行的数据库,该数据库的最近活动小于,5分钟前,b $ b。列表可以按字母顺序显示或按时间戳排序




-A


axlq写道:


文章< 6u **************************** **** @ 4ax.com>,

Michael Fesser< ne ***** @ gmx.dewrote:


> ; .oO(Ciaran)


>>嗨我见过这几个地方 - 该网站列出了
人数(尚未登录)目前正在浏览网站。我怎么能用php / mySQL做这个呢?


你可以使用rand()。

这样的统计数据从来都不准确。 HTTP是无状态协议,没有像当前在线用户这样的东西。用户来,
发送请求,得到响应,然后就消失了。下一个请求,下一个用户。



VBulletin软件不仅使用论坛登录了多少用户和

,还列出了他们的名字。


可以合理地假设对于像论坛这样的网站,如果用户

登录,该用户可能仍会在论坛上查看
用户最近一次活动后
分钟。应该很容易

保持一个正在运行的数据库,该数据库的最近活动小于,5分钟前,b $ b。列表可以按字母顺序显示或按时间戳排序




-A



否,这不是一个合理的假设。有些人可能会留下10

秒,其他人则需要10个小时。


正如Micha所说 - HTTP是一种无状态协议。所有你真正知道的是

,当发送回复时,用户*可能*仍在那里。

但即使这样也不确定。


任何其他人物都是纯粹的废话。


-

============ ======

删除x来自我的电子邮件地址

Jerry Stuckle

JDS计算机培训公司
js ******* @ attglobal.net

==================


Hi I''ve seen this a few places - The site lists off the number of
people (not logged in) currently browsing the site. How can I do this
with php / mySQL please?

解决方案

..oO(Ciaran)

>Hi I''ve seen this a few places - The site lists off the number of
people (not logged in) currently browsing the site. How can I do this
with php / mySQL please?

You can use rand().

Such "statistics" are never accurate. HTTP is a stateless protocol,
there''s no such thing like a "currently online user". A user comes,
sends a request, gets a response and is gone. Next request, next user.

Micha


In article <6u********************************@4ax.com>,
Michael Fesser <ne*****@gmx.dewrote:

>.oO(Ciaran)

>>Hi I''ve seen this a few places - The site lists off the number of
people (not logged in) currently browsing the site. How can I do this
with php / mySQL please?


You can use rand().

Such "statistics" are never accurate. HTTP is a stateless protocol,
there''s no such thing like a "currently online user". A user comes,
sends a request, gets a response and is gone. Next request, next user.

The VBulletin software not only says how many users are logged in and
using the forum, but also lists their names.

It is reasonable to assume that for a site like a forum, if a user
logs in, that user will probably still be looking at the forum a
minute after the user''s most recent activity. It should be easy to
keep a running database of users whose recent activity is less than,
say, 5 minutes ago. The list could be displayed alphabetically or
sorted by timestamp.

-A


axlq wrote:

In article <6u********************************@4ax.com>,
Michael Fesser <ne*****@gmx.dewrote:

>.oO(Ciaran)

>>Hi I''ve seen this a few places - The site lists off the number of
people (not logged in) currently browsing the site. How can I do this
with php / mySQL please?

You can use rand().

Such "statistics" are never accurate. HTTP is a stateless protocol,
there''s no such thing like a "currently online user". A user comes,
sends a request, gets a response and is gone. Next request, next user.


The VBulletin software not only says how many users are logged in and
using the forum, but also lists their names.

It is reasonable to assume that for a site like a forum, if a user
logs in, that user will probably still be looking at the forum a
minute after the user''s most recent activity. It should be easy to
keep a running database of users whose recent activity is less than,
say, 5 minutes ago. The list could be displayed alphabetically or
sorted by timestamp.

-A

No, that is not a reasonable assumption. Some people may stay 10
second, others 10 hours.

As Micha said - HTTP is a stateless protocol. All you really know is
that the user is *probably* still there when a response is being sent.
But even that is not for sure.

Any other figure is a pure crap shoot.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


这篇关于在我的网站上统计访客的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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