开发者

how many connected users? [closed]

开发者 https://www.devze.com 2023-01-15 15:26 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. 开发者_如何转开发 Closed 10 years ago.

is there a way to know how many ip's are connected on your site address using php or js?


At least not using JavaScript :) In PHP you basically need to hook on every HTTP request and then INSERT or UPDATE a row in a online_user table based on the session ID as key and current timestamp as value. When requesting the data, first DELETE the users who have not been online for more than X minutes ago and then do a SELECT COUNT on the table.


Not a single one.
Clients not being connected to your site all the time.
They connect, get page contents, and disconnect.

You can just estimate a rough number, based on number of recent requests

0

精彩评论

暂无评论...
验证码 换一张
取 消