TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,166
  • Total Topics: 21,346
  • Online today: 518
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 446
  • Total: 447
  • NonStop

Users Online Today

Started by JayT, January 28, 2006, 05:47:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

alan s

Users Online Today
An Error Has Occurred!
Unknown(/public_html/whiplash/SSI.php): failed to open stream: No such file or directory
Back

Notice: Array to string conversion in /home/whiplash/public_html/whiplash/Sources/Subs.php on line 1876

Notice: Undefined offset: 1 in /home/whiplash/public_html/whiplash/Sources/Subs.php on line 1878

Users Online Today

Warning: Unknown(/public_html/whiplash/SSI.php): failed to open stream: No such file or directory in /home/whiplash/public_html/whiplash/Sources/Load.php(1040) : eval()'d code(34) : eval()'d code on line 1

Warning: Unknown(/public_html/whiplash/SSI.php): failed to open stream: No such file or directory in /home/whiplash/public_html/whiplash/Sources/Load.php(1040) : eval()'d code(34) : eval()'d code on line 1

Fatal error: (null)(): Failed opening required '/public_html/whiplash/SSI.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/whiplash/public_html/whiplash/Sources/Load.php(1040) : eval()'d code(34) : eval()'d code on line 1
this is what i am getting??

snork13

Quote from: core on March 05, 2006, 02:31:29 AM
aloha!

bad news about above code by Snork... I have been clearing up errors in the forum error log and I found 3 SSI errors wich come from above code!

errors:


8: Undefined index: show_stats
File: /home/resellers/841289/841289/corenation.com/www/smf/SSI.php
Line: 1711

8: Undefined index: num_users_hidden
File: /home/resellers/841289/841289/corenation.com/www/smf/SSI.php
Line: 1698

8: Undefined index: users_online
File: /home/resellers/841289/841289/corenation.com/www/smf/SSI.php
Line: 1698


as soon as I turn the block off - no errors!

please help resolve!

cheers,

core

i just don't have the time to look into this week, but have you check the language files, would be my first look

snork13

Quote from: Alan S on March 06, 2006, 09:43:27 AM
Users Online Today
An Error Has Occurred!
Unknown(/public_html/whiplash/SSI.php): failed to open stream: No such file or directory
Back

Notice: Array to string conversion in /home/whiplash/public_html/whiplash/Sources/Subs.php on line 1876

Notice: Undefined offset: 1 in /home/whiplash/public_html/whiplash/Sources/Subs.php on line 1878

Users Online Today

Warning: Unknown(/public_html/whiplash/SSI.php): failed to open stream: No such file or directory in /home/whiplash/public_html/whiplash/Sources/Load.php(1040) : eval()'d code(34) : eval()'d code on line 1

Warning: Unknown(/public_html/whiplash/SSI.php): failed to open stream: No such file or directory in /home/whiplash/public_html/whiplash/Sources/Load.php(1040) : eval()'d code(34) : eval()'d code on line 1

Fatal error: (null)(): Failed opening required '/public_html/whiplash/SSI.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/whiplash/public_html/whiplash/Sources/Load.php(1040) : eval()'d code(34) : eval()'d code on line 1
this is what i am getting??

your link to your ssi.php is wrong or not there

crappyday

erm, I tried this with both 1.1 RC2 and on 1.0.6 using TP and well yeah it's great, it's just another users online, not users online today.  On both boards I've tested this with, it's shown only the current users online

Yngwiedis

Quote from: snork13 on March 06, 2006, 03:39:07 PM
Quote from: core on March 05, 2006, 02:31:29 AM
aloha!

bad news about above code by Snork... I have been clearing up errors in the forum error log and I found 3 SSI errors wich come from above code!

errors:


8: Undefined index: show_stats
File: /home/resellers/841289/841289/corenation.com/www/smf/SSI.php
Line: 1711

8: Undefined index: num_users_hidden
File: /home/resellers/841289/841289/corenation.com/www/smf/SSI.php
Line: 1698

8: Undefined index: users_online
File: /home/resellers/841289/841289/corenation.com/www/smf/SSI.php
Line: 1698


as soon as I turn the block off - no errors!

please help resolve!

cheers,

core

i just don't have the time to look into this week, but have you check the language files, would be my first look

Any news about these errors ? I cant find anything wrong on my language files...

Yngwiedis


deniz

which language file should change ??

Haiduk

#17
I'm also using 1.1rc2
PLEASE PLEASE PLEASE ALWAYS BACKUP FILES BEFORE CHANGING THEM!!!

Okay I played around with this idea some today.  I tried the PHPbox method and noticed that the regular Stats Box wasn't showing Online Today.  I wanted to show the Users that were online today within the Stats Box and Light an Icon if they were also currently online.  I also wanted a nice way to see what time they were online.

These are the changes I made.  They worked for me without generating errors.

in SSI.PHP add before the ?> at the end, add this:


// Shows a list of online users:  YY Guests, ZZ Users and then a list...  Also shows who was online TODAY
function ssi_whosOnline_today($output_method = 'echo')
{
global $txt, $scripturl, $db_prefix, $ID_MEMBER, $user_info, $sourcedir;
global $modSettings, $settings;
//global $context;

// Load the users online right now.
$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))", __FILE__, __LINE__);

$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;
$return['buddies'] = 0;
$show_buddies = !empty($user_info['buddies']);

while ($row = mysql_fetch_assoc($result))
{
if (!isset($row['realName']))
$return['guests']++;
elseif (!empty($row['showOnline']) || allowedTo('moderate_forum'))
{
// Some basic color coding...
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

// Bold any buddies.
if ($show_buddies && in_array($row['ID_MEMBER'], $user_info['buddies']))
{
$return['buddies']++;
$link = '<b>' . $link . '</b>';
}

$return['users'][$row['logTime'] . $row['memberName']] = array(
'id' => $row['ID_MEMBER'],
'username' => $row['memberName'],
'name' => $row['realName'],
'group' => $row['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => $link,
'hidden' => empty($row['showOnline']),
'is_last' => false,
);
}
else
$return['hidden']++;
}
mysql_free_result($result);

if (!empty($return['users']))
{
krsort($return['users']);
$userlist = array_keys($return['users']);
$return['users'][$userlist[count($userlist) - 1]]['is_last'] = true;
}
$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];

// echo to screen?
if ($output_method == 'echo')
{
echo '
<div class="smalltext">';

echo '
', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'];

// Hidden users, or buddies?
if ($return['hidden'] > 0 || $show_buddies)
echo '
(' . ($show_buddies ? ($return['buddies'] . ' ' . ($return['buddies'] == 1 ? $txt['buddy'] : $txt['buddies'])) : '') . ($show_buddies && $return['hidden'] ? ', ' : '') . (!$return['hidden'] ? '' : $return['hidden'] . ' ' . $txt['hidden']) . ')';

echo '<br />';
foreach ($return['users'] as $user)
echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'], $user['is_last'] ? '' : ', ';

echo'</div><br /><hr>';
}

// Load the users online today.
$nowdate = @getdate(forum_time(false));
$midnight = mktime(0, 0, 0, $nowdate['mon'], $nowdate['mday'], $nowdate['year']) - ($modSettings['time_offset'] * 3600);

$s = strpos($user_info['time_format'], '%S') === false ? '' : ':%S';
if (strpos($user_info['time_format'], '%H') === false && strpos($user_info['time_format'], '%T') === false)
$time_fmt = '%I:%M' . $s . ' %p';
else
$time_fmt = '%H:%M' . $s;

$result = db_query("
SELECT
mem.ID_MEMBER, mem.lastLogin, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP, mg.groupName
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP)) WHERE mem.lastLogin >= $midnight", __FILE__, __LINE__);

$return['users_online_today'] = array();
$return['list_users_online_today'] = array();

while ($row = mysql_fetch_assoc($result))
{
$userday = strftime('%d', forum_time(true));
$loginday = strftime('%d', forum_time(true, $row['lastLogin']));
$yesterday = $userday == $loginday ? '' : $txt['uot_yesterday'];

$lastLogin = $yesterday . strftime($time_fmt, forum_time(true, $row['lastLogin']));
$title = (allowedTo('moderate_forum') || !empty($row['showOnline'])) ? ' title="' . $lastLogin . '"' : '';

// Some basic color coding...
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '"' . $title . ' style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '"' . $title . '>' . $row['realName'] . '</a>';

$is_buddy = in_array($row['ID_MEMBER'], $user_info['buddies']);
if ($is_buddy)
{
$link = '<b>' . $link . '</b>';
}

$is_online = false;
if ($return['num_users']>0)
{
foreach($return['users'] as $user)
{
if ($user['id'] == $row['ID_MEMBER'])
{
$is_online = true;
}
}
}

$return['users_online_today'][$row['lastLogin'] . $row['memberName']] = array(
'id' => $row['ID_MEMBER'],
'username' => $row['memberName'],
'name' => $row['realName'],
'group' => $row['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => $link,
'is_buddy' => $is_buddy,
'is_online' => $is_online,
'hidden' => empty($row['showOnline']),
);

$return['list_users_online_today'][$row['lastLogin'] . $row['memberName']] = (empty($row['showOnline']) && allowedTo('moderate_forum')) ? '<i>' . $link . '</i>' : $link;
}
mysql_free_result($result);

krsort($return['users_online_today']);
krsort($return['list_users_online_today']);

$return['num_users_online_today'] = count($return['users_online_today']);

// echo to screen?
if ($output_method == 'echo')
{
echo '
<div class="smalltext">';

echo $return['num_users_online_today'], ' ', $return['num_users_online_today'] == 1 ? strtolower($txt['user']) : strtolower($txt['users']);

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($return['users_online_today']))
echo '
', 'online today', ':<br />', implode(', ', $return['list_users_online_today']);

echo '
<br />', $return['show_stats'] && !$settings['show_sp1_info'] ? '
<a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
</div>';
}
else
return $return;
}



and in the TPortalBlocks.template.php find the TPortal_statsbox() function:

just after this:


// TPortal stats box
function TPortal_statsbox()
{
       global $context, $settings, $options, $scripturl, $txt, $modSettings;

$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet2 = '<img src="'.$settings['images_url'].'/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';



add this:



$bullet_on = '<img src="'.$settings['images_url'].'/useron.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet_off = '<img src="'.$settings['images_url'].'/useroff.gif" alt="" border="0" style="margin:0 2px 0 0;" />';



and just after this:


if(isset($context['TPortal']['userbox']['online']))
{
// add online users
            echo '<hr /><img src="'.$settings['images_url'].'/icons/online.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a><br />';

            $online = ssi_whosOnline('array');
echo $bullet.$txt['tp-users'].': '.$online['num_users'];
echo '<br />'.$bullet.$txt['tp-guests'].': '.$online['guests'];
//echo '<br />'.$bullet.$txt['tp-total'].': '.$online['total_users'].'<hr />
echo '<br />'.$bullet.$txt['tp-total'].': '.$online['total_users'].'
<div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'"><br />';

foreach($online['users'] as $user)
{
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
}
echo '</div>';



add this:


// add online today
            echo '<br /><b>Online Today</b><br />';

            $online = ssi_whosOnline_today('array');

echo $bullet.$txt['tp-total'].': '.$online['num_users_online_today'].'
<div style="width: 100%; ' , $online['num_users_online_today']>14 ? 'height: 23ex;overflow: auto;' : '' ,'"><br />';

foreach($online['users_online_today'] as $user)
{
if ($user['is_online'])
echo $bullet_on, $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
else
echo $bullet_off, $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];

echo '<br />';
}
echo '</div>';




also works from a PHP block with this code:

require("/home/********PATH_TO_YOUR_FILE/public_html/smf/SSI.php");

ssi_whosOnline_today();



I am still pretty new to PHP, but I'm learning.  If you know a better and/or more efficient way to do this, please by all means tell us about it.

RoarinRow


SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

akulion

Gabo Gabo (Thank you in venutian) :D

This website is proudly hosted on Crocweb Cloud Website Hosting.