users online ...

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
jazcyk
Posts: 385
Joined: Wed Sep 07, 2005 1:32 pm

users online ...

Post by jazcyk »

How does phpmyfaq determine the number of users online? I just experienced that it told med 'O users online'. I really became in doubt if I was there or it was just a dream .... :lol:

I know it is a problem with the HTTP protocol that it actually is impossible for the server to determine if user is still there or if he has closed the last page that was sent. There is no 'logon' to a webserver - only hypertext is requested and sent.
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

See userOnline() in inc/functions.php

Post by matteo »

First, we try to get the number of unique users assigning them a unique Session ID (sid) stored, if possibile, in a 1h-TTL cookie (otherwise we append it as an HTTP GET key) and in the faqsessions table.
The evaluation is performed on the database counting the whole of the sids with a lifetime <= 5min.
Maybe it would be more correct to refer to this number as "the number of unique users who have perfomed some activities within the last five minutes".

We'll take a look on your issue: is that achievied upon your live installation?
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
jazcyk
Posts: 385
Joined: Wed Sep 07, 2005 1:32 pm

where

Post by jazcyk »

I experienced that at www.webyog.com/faq.

After several page refreshes and after about 30 seconds it finally displayed '1 users online'. I think it would be more correct to display 'x users active within last 5 minutes' . A webserver can't possibly tell how many are 'online' - it can tell when hypertext was sent to a client only. Whether user is still 'active' (reading the page) or she has gone to bed it can't tell :-)

It is not a big issue - all webserver module (PHP, ASP, JSP, RUBY etc.) software has this sort of problem! The only problem is that people who don't understand the workings of the HTTP-protocol may put a more 'autoritative' importance into this display than what is justified.
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Re: where

Post by matteo »

jazcyk wrote:After several page refreshes and after about 30 seconds it finally displayed '1 users online'.
I found the issue on the code: I'm working on the fix.
jazcyk wrote:I think it would be more correct to display 'x users active within last 5 minutes' . A webserver can't possibly tell how many are 'online' - it can tell when hypertext was sent to a client only. Whether user is still 'active' (reading the page) or she has gone to bed it can't tell :-)
I'll wait for Thorsten thought 'cause we'd change the meaning of a key in the language file: maybe it will be possibile for PMF 1.6.x (not for PMF 1.5.x).
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Fixed on PMF 1.5.x and 1.6.x

Post by matteo »

Hi jazcyk,
within 2 hours you'll be able to retrieve the fix from the nightly built snapshots, both 1.5.x and 1.6.x..
The files affected are:

Code: Select all

index.php
inc/functions.php
FYI, see the details of the fix here (PMF 1.5.x) and here (PMF 1.6.x.).
I'd suggest you to backup your original files in order to recover any possible error on your production environment: we already made some fixes on 1.5.8dev and currently it is not exactly equal to the code of the 1.5.7 release.
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
Thorsten
Posts: 15834
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

thanks to Matteo for fixing this issue!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
jazcyk
Posts: 385
Joined: Wed Sep 07, 2005 1:32 pm

seems to work

Post by jazcyk »

The new files seem to work fine in the production environment. (1.5.7).
But of course I cannot verify that numbers are correct ...
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Thank you for having verified the fix.
Trust the number :wink:
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
Post Reply