tags:

views:

73

answers:

2

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

+2  A: 

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.

BalusC
+4  A: 

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

Col. Shrapnel