Forum Moderators: coopster & phranque

Message Too Old, No Replies

How many people on my site?

without them logging in

         

stickytape

11:20 pm on Jul 19, 2001 (gmt 0)



Is it possible to have a live count of how many people are currently on the site without them actually logging in.

Actually, I'll rephrase that, cos I just thought about WMW's there are XX guests and YY Members currently.....blar blar, so HOW do I put a live count.

Preferably in PHP again, cos like I said, I can read PHP and run it nicely on my crappy Win ME Box. (don't laugh)

Cheers! ANy ideas welcome as always

grnidone

10:32 pm on Jul 20, 2001 (gmt 0)



Kicking this to the top so it will get an answer.
=G

Bolotomus

10:48 pm on Jul 20, 2001 (gmt 0)

10+ Year Member



In my opinion, the short answer is "no" you cannot know that without some degree of error.

For one thing, of course there is no way to know that a user has left your site other than the fact they haven't requested a page in a while. How you define "a while" will influence your results.

Also, whether or not your pages are cached can influence how often you actually see their requests in your logfiles. In theory, somebody could be using your site in the true sense of the term, and you wouldn't even know it.

Then there is the question of how to identify "unique visitors." Is that the same as unique IP addresses? No. You might try cookies, but how do you measure people who don't accept your cookie?

If none of that discourages you, try looking at the last 30 minutes of your logfile and count the unique IP address. I've used that method myself, mostly for fun. It's an entertaining figure to watch even if it doesn't mean much.

Bolotomus

stickytape

2:49 am on Jul 21, 2001 (gmt 0)



In my opinion, the short answer is "no" you cannot know that without some degree of error. -

OK, thanks for your comment, but can anyone describe how sites such as sites with certain bulletin boards and certain NukePHP sites can display how many guests and users are currently online??? I really am kerfuffled over this.

I had a thought that I could use a MySQL database to log IP addresses and send pings to them, and if the ping result was less than say, 1000 then the user was online, but this would take immense server usage. Please, can someone suggest a sensible answer to this?? I know it can be done, Im just not sure how. Cheers guys!!

Rich

Bolotomus

11:29 am on Jul 24, 2001 (gmt 0)

10+ Year Member



The sites that show how many people are logged in are using some hokey method like I described above. E.g., perhaps they use cookies, and have a database so they know how many people either returned after a long absence, or got a new cookie, within the last 15 minutes. You don't know their methods unless they tell you, but rest assured, it's not an accurate count.

Knowing when unique visitors come to your site is hard but not undoable. Knowing when they leave is completely impossible. But if you make some abritrary rule, such as "anybody who hasn't requested a page in (n) minutes has left," then you can work from there.

Bolot

rpking

12:13 pm on Jul 24, 2001 (gmt 0)

10+ Year Member



This [mcpcentral.com] is an example of how to do it in ASP. Not tried it myself or had a long look, but seems to do what you need. Don't think this method can be translated to PHP though...

sugarkane

12:19 pm on Jul 24, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



PHP 4 includes session handling functions which could probably be used to do something like what you want, but Bolotomus' points are all valid.

I've never actually used these functions, but there's some info here [php.net] to get you started.