Reply to Re: Count visitors on my website

Your name:

Reply:


Posted by Gordon Burditt on 07/15/07 01:31

>>>>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
>>
>> So you clearly have no clue.
>
>Ha!
>
>> PHP maintains sessions and the user can be logged for that duration and
>> therefore only counted once.
>
>And it clearly says right up there in the Original Post: "not logged in".
>
>That means no session.

No, "not logged in" does *NOT* mean "no session". For some login
setups, "no session" (e.g. they've got cookies turned off, and
you're not passing the session identifier in the URL) means "no
ability to sustain a login", but that's a completely different
issue.

>And even if there *is* a session how do you know the user hasn't opened a
>new tab and is busily looking at somebody elses site, or turned their
>computer off, or simply wandered off down to the pub for lunch?

Or is talking on the phone, or is asleep, or ...

>With sessions you can tell how many people have used your login form and
>have yet to use your logout form, or yet to be timed out. You can not tell
>how many people are "browsing the site".

Sessions do not require a login form. But even if you have a "logout form",
users hardly ever use it unless there's some really sensitive information
or control with it (like online banking). About the only thing you can
do is assume a timeout: no hit in N minutes for that session, they've
probably left.

>I administer several sites that use logins. Sometimes I visit one only to
>find that I had last "logged in" several days ago and my browser is still
>hanging on to the session cookie.

If you're trying to count "unique visitors", you've got an even worse
problem. Spammers often sign up multiple accounts for the same user.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация