Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Leo2 on October 22, 2012, 03:20:24 AM

Title: Online users counter doesn't work
Post by: Leo2 on October 22, 2012, 03:20:24 AM
After some database upgrade made by my hoster, the online users counter stopped to work. It shows 0 guests and 0 users all the time, and doesn't update statistics (total users today).

What should I check and do to fix that?
Title: Re: Online users counter doesn't work
Post by: hcfwesker on October 22, 2012, 03:47:50 AM
Maybe under Admin > Maintenance > Routine >  run the "Recount all forum totals and statistics" and possibly "Find and repair any errors" and see if that helps.
Title: Re: Online users counter doesn't work
Post by: Leo2 on October 22, 2012, 04:53:23 AM
No, that didn't help, I already thought about that.

I guess that problem can be handling sessions - but don't know how to check that. There is no errors in the forum logs
Title: Re: Online users counter doesn't work
Post by: Storman™ on October 22, 2012, 05:10:49 AM
QuoteAfter some database upgrade made by my hoster

Have you asked your host for details of exactly what they did as it would aid a solution....

Otherwise it's pure presumption.   ;)
Title: Re: Online users counter doesn't work
Post by: Leo2 on October 22, 2012, 07:35:19 AM
of course! They tell me that they just moved database to new server. Files are located in different server, so they say that files didn't change.

Actually, there was another problem with the forum after that 'upgrade', GeoIp mod doesn't work now because of MAX_JOIN_SIZE error (see here (http://www.simplemachines.org/community/index.php?topic=458315.msg3425351#msg3425351) my question about that)
Title: Re: Online users counter doesn't work
Post by: Storman™ on October 22, 2012, 08:26:03 AM
QuoteActually, there was another problem with the forum after that 'upgrade', GeoIp mod doesn't work now because of MAX_JOIN_SIZE error

Well that's one for your host really, assuming you're on shared hosting then that can only be amended in the MySQL configuration.

To be honest both these issues need to go back to your host, they've obviously changed their set-up but not taken into account potential client issues. Unfortunately, it's the sort of thing you'll get on shared hosting, the relatively low cost has caveats.
Title: Re: Online users counter doesn't work
Post by: Leo2 on October 22, 2012, 11:38:55 AM
I don't think they have restrictions which blocks online users counters (unlike geoip, that is resource consuming mod).

What can I and my probider do to debug that issue?
Where are the sessions stored and how the counter retrieve and process that information?
Title: Re: Online users counter doesn't work
Post by: Colin on October 22, 2012, 02:28:54 PM
Are you able to login to your forum alright?
Title: Re: Online users counter doesn't work
Post by: Leo2 on October 23, 2012, 04:21:38 AM
Quote from: Colin on October 22, 2012, 02:28:54 PM
Are you able to login to your forum alright?
yes
Title: Re: Online users counter doesn't work
Post by: Colin on October 23, 2012, 10:10:13 AM
Great, is there any chance we can get a link to your board?
Title: Re: Online users counter doesn't work
Post by: Leo2 on October 23, 2012, 05:07:21 PM
sure  :)
http://www.solarhome.ru/forum/

It is in Russian, though...

and I forgot to mention - online status in the user profile (that small square left to the user name) doesn't work too since the 'upgrade'
Title: Re: Online users counter doesn't work
Post by: Colin on October 23, 2012, 07:07:13 PM
Mind if I make a test account?
Title: Re: Online users counter doesn't work
Post by: hcfwesker on October 23, 2012, 08:12:34 PM
Most times when my servers update or move, I have to goto phpMyAdmin and check the database table "smf_log_online" and select "repair table".  I'm sure you already thought of that but just trying to give advice from my own experience.
Title: Re: Online users counter doesn't work
Post by: Leo2 on October 24, 2012, 03:34:49 AM
Quote from: Colin on October 23, 2012, 07:07:13 PM
Mind if I make a test account?
Sure, you can make the account, advise if you will need help at registration  or additional permissions
Quote from: hcfwesker on October 23, 2012, 08:12:34 PM
Most times when my servers update or move, I have to goto phpMyAdmin and check the database table "smf_log_online" and select "repair table".  I'm sure you already thought of that but just trying to give advice from my own experience.
This table is empty now.
I made the repair, but that doesn't help.
Title: Re: Online users counter doesn't work
Post by: Joker™ on October 27, 2012, 09:12:17 AM
Not sure about the exact cause of the issue but try to empty your forum cache.

Also please mention the mods installed on your forum.
Title: Re: Online users counter doesn't work
Post by: Leo2 on November 01, 2012, 12:13:16 PM
Installed mods
Quote1.    geoIP Location    1.1.1    
2.    Users Online Today    2.0.3    
3.    The Rules    1.3    
4.    SMF 2.0.2 Update    1.0
5.    Delete Spam Posts    1.6    
6.    Highslide BBCode and Image Viewer    1.1
7.    Disable 'last edit by...' for Administrators    1.7
8.    Search Focus Dropdown    1.6.1    
9.    Optimus Brave    1.8    
10.    Alt Characters v1.7    1.7    
11.    JumpToSelectBoard By Smfsimple.com    V1
12.    Smart Pagination    0.8
13.    Users mass actions    0.1.1    
14.    Forum Faces ~ Avatars    0.1
15.    Back to the index    0.2    
16.    Socialize    1.8
17.    Join date and Location in Posts    1.3
18.    Aeva ~ Auto-Embed Video & Audio    7.2    
Title: Re: Online users counter doesn't work
Post by: Joker™ on November 05, 2012, 11:08:19 AM
Users Online Today -- Try disabling the mod for a while and see if it resolves the issue.
Title: Re: Online users counter doesn't work
Post by: Leo2 on November 10, 2012, 05:14:29 PM
Quote from: Joker™ on November 05, 2012, 11:08:19 AM
Users Online Today -- Try disabling the mod for a while and see if it resolves the issue.
I installed that mode AFTER the problem with online users counting appeared. So, it is not the cause of the problem.

I still have question about how (where are the scripts) and where (database or files) SMF handles the sessions. I suspect that the problem is with incorrect session handling.
Title: Re: Online users counter doesn't work
Post by: Joker™ on November 14, 2012, 10:35:10 PM
Quote from: Leo2 on November 10, 2012, 05:14:29 PM
I still have question about how (where are the scripts) and where (database or files) SMF handles the sessions. I suspect that the problem is with incorrect session handling.
Subs.php

Code (function) Select
function writeLog($force = false)

As you said that {db_prefix}log_online table is empty, so you should make a check whether this function is inserting the data or not.
Title: Re: Online users counter doesn't work
Post by: Leo2 on November 17, 2012, 09:21:02 AM
Quote from: Joker™ on November 14, 2012, 10:35:10 PM
Quote from: Leo2 on November 10, 2012, 05:14:29 PM
I still have question about how (where are the scripts) and where (database or files) SMF handles the sessions. I suspect that the problem is with incorrect session handling.
Subs.php
Thank you much for the direction! I finally found the error!

After the database update the forum didn't work at all because of SQL_BIG_SELECTS error caused by geoip (http://www.simplemachines.org/community/index.php?topic=458315.msg3425440#msg3425440) (Thank you Joker for that hint again!). I commented this part of the Subs.php to revive the forum.
// some geoIP for the map and online list when they first login
$geoIP = array();
if (!empty($modSettings['who_enabled']) && !empty($modSettings['geoIP_db']) && (!empty($modSettings['geoIP_enablemap']) || !empty($modSettings['geoIP_enableflags'])) && !empty($user_info['ip']))
{
// do a lookup, but database only, don't want the slowness of a network call here.
include_once($sourcedir . '/geoIP.php');
$geoIP = ($modSettings['geoIP_db'] == 2) ? geo_search_lite($user_info['ip'], false) : geo_search($user_info['ip'], false);
}
if (!empty($geoIP[0]))
$smcFunc['db_insert']($do_delete ? 'ignore' : 'replace',
'{db_prefix}log_online',
array('session' => 'string', 'id_member' => 'int', 'id_spider' => 'int', 'log_time' => 'int', 'ip' => 'raw', 'url' => 'string', 'latitude' => 'float', 'longitude' => 'float', 'country' => 'string', 'city' => 'string', 'cc' => 'string'),
array($session_id, $user_info['id'], empty($_SESSION['id_robot']) ? 0 : $_SESSION['id_robot'], time(), 'IFNULL(INET_ATON(\'' . $user_info['ip'] . '\'), 0)', $serialized, $geoIP[0]['latitude'], $geoIP[0]['longitude'], $geoIP[0]['country'], $geoIP[0]['city'], $geoIP[0]['cc']),
array('session')
);
else
$smcFunc['db_insert']($do_delete ? 'ignore' : 'replace',
'{db_prefix}log_online',
array('session' => 'string', 'id_member' => 'int', 'id_spider' => 'int', 'log_time' => 'int', 'ip' => 'raw', 'url' => 'string'),
array($session_id, $user_info['id'], empty($_SESSION['id_robot']) ? 0 : $_SESSION['id_robot'], time(), 'IFNULL(INET_ATON(\'' . $user_info['ip'] . '\'), 0)', $serialized),
array('session')
);

It was not changed after reinstallation of the geoip mod because it was commented (and the mod didn't recognize that part of the page is commented).

Now the counter works. Thank you all who tried to help me!

BTW, GeoIP shows different number of users online (usually less than the forum's online users counter). But this is another story :)


Title: Re: Online users counter doesn't work
Post by: Joker™ on November 18, 2012, 08:14:37 AM
If your issue is solved please mark the topic as solved.

Also, have you pointed the issue to mod author?
Title: Re: Online users counter doesn't work
Post by: Leo2 on November 23, 2012, 11:02:33 AM
I noticed one more thing - the online counter works, but the totals for 'today' and max for the whole period are not updated.
I see that the writelog function is also in Subs.php, but don't know what to check.
So, the problem is that mostOnline and MostOnlineToday field are not update in smf_settings table