Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Yikesfactor on October 12, 2018, 10:39:20 PM

Title: How does a username stay on the active users list all the time?
Post by: Yikesfactor on October 12, 2018, 10:39:20 PM
The one thing I've not been able to do I want to is have a moderator listed on the active users list 24/7.

So you can imagine my surprise to notice a username which is always on there.

How can a username always be there, when the active users is set to 15 minutes, and even I drop off it while I'm doing something else?

The user has 3 posts, but none since I noticed the name always being there.

Is this a bot running on a person started account?

Anyone know how this can be done?

Can this display be changed to be logged on instead of active?

My concern for this account stems from it being a known associate of a troublemaker who has left the forum, with the suspicion this is the actual troublemaker pretending to be someone else.

I'm also worried about the possibility of this being a data mining situation, designed to undermine the forum when something being searched for happens. Am I paranoid? Probably.
Title: Re: How does a username stay on the active users list all the time?
Post by: Kindred on October 12, 2018, 10:40:50 PM
You can change the text in the language files...
As for h9m he stays onl8me... maybe he has a script that sends a keep alive ping
Title: Re: How does a username stay on the active users list all the time?
Post by: Sir Osis of Liver on October 12, 2018, 10:51:44 PM
Quote from: Yikesfactor on October 12, 2018, 10:39:20 PM
Can this display be changed to be logged on instead of active?

That would be incorrect, you can stay logged in for a long time without being active.  As admin, you can go into any profile and disable Show others my online status, or you can ban the ip in .htaccess.

Title: Re: How does a username stay on the active users list all the time?
Post by: Yikesfactor on October 12, 2018, 11:00:34 PM
Quote from: Kindred on October 12, 2018, 10:40:50 PM
You can change the text in the language files...

Its not the language I want changed, but the nature of the list. Active and logged-in are not the same list. Changing the text wont change the list being displayed.


QuoteAs for h9m he stays onl8me... maybe he has a script that sends a keep alive ping

How do you do that?


Quote from: Sir Osis of Liver on October 12, 2018, 10:51:44 PM
Quote from: Yikesfactor on October 12, 2018, 10:39:20 PM
Can this display be changed to be logged on instead of active?

That would be incorrect, you can stay logged in for a long time without being active.  As admin, you can go into any profile and disable Show others my online status, or you can ban the ip in .htaccess.

That's the opposite of what I want. I'd rather see who is logged in, than who is active. And I'd like my username always showing. I've had one case of someone posting something contentious after waiting for me to go to bed first. I'd just as soon no-one could be sure if I was there or not.

IP banning has some serious consequences, so its a last resort. And I'm not there yet.
Title: Re: How does a username stay on the active users list all the time?
Post by: Sir Osis of Liver on October 12, 2018, 11:13:06 PM
I don't believe the forum can detect a member who is logged in but hasn't been active within the selected timespan.  You can hide your own online status, so no one knows if you're there or not.  I've done that here for years to discourage people from pming me for support.  Banning a single ip has no effect other than preventing that ip from reaching the forum.

Title: Re: How does a username stay on the active users list all the time?
Post by: Yikesfactor on October 12, 2018, 11:24:28 PM
Quote from: Sir Osis of Liver on October 12, 2018, 11:13:06 PM
I don't believe the forum can detect a member who is logged in but hasn't been active within the selected timespan.

Seriously? phpBB early versions did this on the front page of their admin section. You could not only see who is logged in, but where they currently were on the boards. No idea if they still do, as once they made the interface so complicated you needed a pilots license, I stopped upgrading, and its been more than a few years now.

Ok, if one must be active then, how can I do it? Anyone have a script I can use?

Also, is there any way of telling if someone else is using such a script? Something I can check in Cpanel perhaps?

Title: Re: How does a username stay on the active users list all the time?
Post by: Sir Osis of Liver on October 13, 2018, 12:00:50 AM
Hmm, looking through the code, the list of active users is populated in Who.php.  Logged in users are saved in smf_log_online, they're added on login, removed on logout.  If user leaves forum (i.e. closes/clears browser), they remain in smf_log_online for less than a minute, then are dropped.  If user leaves forum without logging out, at some point they're dropped from table, but restored on next page load with timestamp from last login.  The activity timeout doesn't appear to be connected to the cookie timestamp.  Don't know how any of this may help you, still tinkering with it.
Title: Re: How does a username stay on the active users list all the time?
Post by: Yikesfactor on October 13, 2018, 12:05:33 AM
Activity timeout? How about changing this to some very high number in the high 1 digit hours range?
Title: Re: How does a username stay on the active users list all the time?
Post by: Sir Osis of Liver on October 13, 2018, 12:18:45 AM
If the user is logged in and pinging the forum, I believe the timeout is reset every page load.  Your guy will remain on active list as long as he's logged in.  Haven't found the timeout code yet, and my eyes are giving out, but I don't see how you can get around this without banning the user.  When he first loads the forum, Load.php looks for the SMF cookie on his computer to determine if he's logged in, it will remain there until he clears browser.  Who.php compiles the active list from smf_log_online -



// Look for people online, provided they don't mind if you see they are.
$request = $smcFunc['db_query']('', '
SELECT
lo.log_time, lo.id_member, lo.url, INET_NTOA(lo.ip) AS ip, mem.real_name,
lo.session, mg.online_color, IFNULL(mem.show_online, 1) AS show_online,
lo.id_spider
FROM {db_prefix}log_online AS lo
LEFT JOIN {db_prefix}members AS mem ON (lo.id_member = mem.id_member)
LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = CASE WHEN mem.id_group = {int:regular_member} THEN mem.id_post_group ELSE mem.id_group END)' . (!empty($conditions) ? '
WHERE ' . implode(' AND ', $conditions) : '') . '
ORDER BY {raw:sort_method} {raw:sort_direction}
LIMIT {int:offset}, {int:limit}',
array(
'regular_member' => 0,
'sort_method' => $sort_method,
'sort_direction' => $context['sort_direction'] == 'up' ? 'ASC' : 'DESC',
'offset' => $context['start'],
'limit' => $modSettings['defaultMaxMembers'],
)
);



If he's logged in and loading pages, he's active.

Title: Re: How does a username stay on the active users list all the time?
Post by: Yikesfactor on October 13, 2018, 12:26:32 AM
Ok, I understand why its active list now. Cookies effectively mean a person is never offline, even when they are.

Here's a question for you: Can a username be inserted into the code, so it always displays on the Active list, even when its not active? First or last position is fine.


Title: Re: How does a username stay on the active users list all the time?
Post by: Sir Osis of Liver on October 13, 2018, 12:48:54 AM
Quote from: Yikesfactor on October 13, 2018, 12:26:32 AM
Ok, I understand why its active list now. Cookies effectively mean a person is never offline, even when they are.

Well, not exactly.  They're dropped from active list if they don't load any pages during timeout interval, added back on when they do.

Quote
Can a username be inserted into the code, so it always displays on the Active list, even when its not active? First or last position is fine.

Not easily that I can see.  There's other information attached to the name, profile link, group color, etc.  May be a way to insert it in the array that's sent to BoardIndex.template.php from Who.php -



// Send the information to the template.
$context['members'][$row['session']] = array(
'id' => $row['id_member'],
'ip' => allowedTo('moderate_forum') ? $row['ip'] : '',
// It is *going* to be today or yesterday, so why keep that information in there?
'time' => strtr(timeformat($row['log_time']), array($txt['today'] => '', $txt['yesterday'] => '')),
'timestamp' => forum_time(true, $row['log_time']),
'query' => $actions,
'is_hidden' => $row['show_online'] == 0,
'id_spider' => $row['id_spider'],
'color' => empty($row['online_color']) ? '' : $row['online_color']
);

$url_data[$row['session']] = array($row['url'], $row['id_member']);
$member_ids[] = $row['id_member'];
}



Or maybe just hack it into the template -



// "Users online" - in order of activity.
echo '
<div class="title_barIC">
<h4 class="titlebg">
<span class="ie6_header floatleft">
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who' . '">' : '', '<img class="icon" src="', $settings['images_url'], '/icons/online.gif', '" alt="', $txt['online_users'], '" />', $context['show_who'] ? '</a>' : '', '
', $txt['online_users'], '
</span>
</h4>
</div>
<p class="inline stats">
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', comma_format($context['num_guests']), ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . comma_format($context['num_users_online']), ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];

// Handle hidden users and buddies.
$bracketList = array();
if ($context['show_buddies'])
$bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
if (!empty($context['num_spiders']))
$bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
if (!empty($context['num_users_hidden']))
$bracketList[] = comma_format($context['num_users_hidden']) . ' ' . $txt['hidden'];

if (!empty($bracketList))
echo ' (' . implode(', ', $bracketList) . ')';

echo $context['show_who'] ? '</a>' : '', '
</p>
<p class="inline smalltext">';

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online']))
{
echo '
', sprintf($txt['users_active'], $modSettings['lastActive']), ':<br />', implode(', ', $context['list_users_online']);

// Showing membergroups?
if (!empty($settings['show_group_key']) && !empty($context['membergroups']))
echo '
<br />[' . implode(']&nbsp;&nbsp;[', $context['membergroups']) . ']';
}


Title: Re: How does a username stay on the active users list all the time?
Post by: Yikesfactor on October 13, 2018, 12:55:18 AM
Is there an add to array command? If so, a username could be added to the array after its been generated, before it gets passed to be displayed. Adds an extra line of code with hardcoded username details?
Title: Re: How does a username stay on the active users list all the time?
Post by: Sir Osis of Liver on October 13, 2018, 01:25:51 AM
I'm tinkering with push_array(), but not having any luck.
Title: Re: How does a username stay on the active users list all the time?
Post by: Sir Osis of Liver on October 13, 2018, 02:06:40 AM
Here's a real crappy way to do it -

BoardIndex.template.php



// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online']))
{
echo '
', sprintf($txt['users_active'], $modSettings['lastActive']), ':<br />', implode(', ', $context['list_users_online']);

// Showing membergroups?
if (!empty($settings['show_group_key']) && !empty($context['membergroups']))
echo '
<br />[' . implode(']&nbsp;&nbsp;[', $context['membergroups']) . ']';
}

echo ', <a  style="color: blue;" href="http://www.domain.com/forum/index.php?action=profile;u=200">Test</a>';

echo '
</p>
<p class="last smalltext">
', $txt['most_online_today'], ': <strong>', comma_format($modSettings['mostOnlineToday']), '</strong>.
', $txt['most_online_ever'], ': ', comma_format($modSettings['mostOnline']), ' (', timeformat($modSettings['mostDate']), ')
</p>';

// If they are logged in, but statistical information is off... show a personal message bar.



(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.thekrashsite.com%2Fpics%2Ffp.gif&hash=d0889cee6120d0a650f84d729e497abcf6c7e975)  Too tired to come up with anything better.


Title: Re: How does a username stay on the active users list all the time?
Post by: Yikesfactor on October 13, 2018, 02:13:57 AM
So this...

echo ', <a  style="color: blue;" href="http://www.domain.com/forum/index.php?action=profile;u=200">Test</a>';


...goes into the middle of that block of code, and it hardwrites whatever you replace Test with?
Title: Re: How does a username stay on the active users list all the time?
Post by: Yikesfactor on October 13, 2018, 02:21:40 AM
Ok,  :o

That didn't work. It replaced the last username on the list with the hardcode, and if you click it, it goes to the last person on the list you couldn't see.

Almost though.  :)

Means you have to use a username which is real though, so the click on can work.
Title: Re: How does a username stay on the active users list all the time?
Post by: Sir Osis of Liver on October 13, 2018, 11:44:11 PM
The sample code I posted displays username 'Test', replace that with your username, and replace 'u=200' with the correct user id for that user.
 
Title: Re: How does a username stay on the active users list all the time?
Post by: Kindred on October 14, 2018, 08:13:55 AM
However, I would question the usefulness of doing this... along with the inherent dishonesty.

Title: Re: How does a username stay on the active users list all the time?
Post by: Sir Osis of Liver on October 14, 2018, 05:16:07 PM
Sadly, honesty is an obsolete concept in today's world. :P

Title: Re: How does a username stay on the active users list all the time?
Post by: landyvlad on October 17, 2018, 03:15:14 AM
This all sounds like it's directed to deal with one problematic user.


To paraphrase Kindred: "There are no technical solutions to social problems."