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
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
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
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
I've never actually used these functions, but there's some info here [php.net] to get you started.