2006-04-20, 12:57 PM
2006-04-20, 02:18 PM
hello there,
open index.php
find
above it add
then in Admin CP >Templates > Modify / delete > expand > index page templates > index_whosonline
modify it to have a new row, and use $onlinetoday to display usernames . use $todaycount to display the total, use $countinv to dispaly how many invisible
regards
open index.php
find
PHP Code:
eval("\$whosonline = \"".$templates->get("index_whosonline")."\";");
above it add
PHP Code:
$todaycount = 0;
$countinv = 0;
$stime = time()-(60*60*24);
����$query = $db->query("SELECT u.* FROM ".TABLE_PREFIX."users u LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup) WHERE u.lastactive > $stime ORDER BY u.lastactive DESC");
����$todaycomma = '';
����$onlinetoday = '';
����while($online = $db->fetch_array($query))
����{
��������if($online['invisible'] != "yes" || $mybb->usergroup['canviewwolinvis'] == "yes")
��������{
������������if($online['invisible'] == "yes")
������������{
����������������$invisiblemark = "*";
$countinv++;
������������}
������������else
������������{
����������������$invisiblemark = "";
������������}
$todaycount++;
������������$onlinetoday .= $todaycomma.formatname($online['username'], $online['usergroup'], $online['displaygroup']).$invisiblemark;
������������$todaycomma = ', ';
��������}
����}
then in Admin CP >Templates > Modify / delete > expand > index page templates > index_whosonline
modify it to have a new row, and use $onlinetoday to display usernames . use $todaycount to display the total, use $countinv to dispaly how many invisible
regards
2006-04-21, 01:26 PM
What if I want a link to their profile from their names at there ?
and what if I want to have how many Guests?
and what if I want to have how many Guests?
2006-04-21, 01:50 PM
xiaozhu Wrote:What if I want a link to their profile from their names at there ?Replace the line
$onlinetoday .= $todaycomma.formatname($online['username'], $online['usergroup'], $online['displaygroup']).$invisiblemark;
with$onlinetoday .= $todaycomma."<a href=\"member.php?action=profile&uid=".$online['uid']."\">".formatname($online['username'], $online['usergroup'], $online['displaygroup']).$invisiblemark."</a>";
xiaozhu Wrote:and what if I want to have how many Guests?Open the file index.php and search for
eval("\$whosonline = \"".$templates->get("index_whosonline")."\";");
Above add: $num_visitors = $db->num_rows($db->query("SELECT * FROM ".TABLE_PREFIX."sessions WHERE time > ".$stime.""));
if($num_visitors == "0")
{
$visitors_online_today = "";
}
else
{
$visitors_online_today = "We had ".$num_visitors." visitors in the last 24 hours";
}
After that you can insert the variable $visitors_online_today into the template index_whosonline where you want to display the number of visitors.2006-04-21, 02:02 PM
Thxs alot
2006-04-21, 02:06 PM
I am getting this error anyway...
Parse error: parse error, unexpected ';' in /home/habbo/public_html/index.php on line 140
Parse error: parse error, unexpected ';' in /home/habbo/public_html/index.php on line 140
2006-04-21, 02:11 PM
Can you please post the lines 130 - 150 of your index.php?
2006-04-21, 02:14 PM
hmm..maybe its here..
$guestbit = $lang->online_guest_singular;
}
$lang->online_note = sprintf($lang->online_note, mynumberformat($onlinecount), $onlinebit, $mybb->settings['wolcutoffmins'], mynumberformat($membercount), $memberbit, mynumberformat($anoncount), $anonbit, mynumberformat($guestcount), $guestbit);
$todaycount = 0;
$countinv = 0;
$stime = time()-(60*60*24);
$query = $db->query("SELECT u.* FROM ".TABLE_PREFIX."users u LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup) WHERE u.lastactive > $stime ORDER BY u.lastactive DESC");
$todaycomma = '';
$onlinetoday = '';
while($online = $db->fetch_array($query))
{
if($online['invisible'] != "yes" || $mybb->usergroup['canviewwolinvis'] == "yes")
{
if($online['invisible'] == "yes")
{
$invisiblemark = "*";
$countinv++;
}
else
{
$invisiblemark = "";
}
$todaycount++;
$onlinetoday .= $todaycomma.formatname($online['username'], $online['usergroup'], $online['displaygroup']).$invisiblemark;
$todaycomma = ', ';
}
}
$num_visitors = $db->num_rows($db->query("SELECT * FROM ".TABLE_PREFIX."sessions WHERE time > ".$stime.""));
if($num_visitors == "0")
{
$visitors_online_today = "";
}
else
{
$visitors_online_today = "We had ".$num_visitors." visitors in the last 24 hours";
}
eval("\$whosonline = \"".$templates->get("index_whosonline")."\";");
2006-04-22, 06:01 PM
ok but when i try to add the line to my portal nothing comes up.
http://www.jdmfloridascene.com/mybb/portal.php
here is what i have in my portal_whosonline
And here is the snip from the code that i entered in portal.php that was from originally from index.php
http://www.jdmfloridascene.com/mybb/portal.php
here is what i have in my portal_whosonline
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td class="tborder">
<table border="0" cellspacing="$theme[borderwidth]" cellpadding="$theme[tablespace]" width="100%">
<tr>
<td class="thead"><strong>$lang->online</strong></td>
</tr>
<tr>
<td class="trow1">
<span class="smalltext">
$lang->online_users<br /><strong>»</strong> $lang->online_counts<br />$onlinemembers
</span>
</td>
</tr>
[color=red]<tr>
<td class="trow1">
<span class="smalltext">
$todaycount   Users Online Today ($todaycount Members, and $countinv   Invisible)
$onlinetoday
</span>
</td>
</tr>[/color]
</table>
</td></tr></table>
<br />
And here is the snip from the code that i entered in portal.php that was from originally from index.php
$todaycount = 0;
$countinv = 0;
$stime = time()-(60*60*24);
$query = $db->query("SELECT u.* FROM ".TABLE_PREFIX."users u LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup) WHERE u.lastactive > $stime ORDER BY u.lastactive DESC");
$todaycomma = '';
$onlinetoday = '';
while($online = $db->fetch_array($query))
{
if($online['invisible'] != "yes" || $mybb->usergroup['canviewwolinvis'] == "yes")
{
if($online['invisible'] == "yes")
{
$invisiblemark = "*";
$countinv++;
}
else
{
$invisiblemark = "";
}
$todaycount++;
$onlinetoday .= $todaycomma."<a href=\"member.php?action=profile&uid=".$online['uid']."\">".formatname($online['username'], $online['usergroup'], $online['displaygroup']).$invisiblemark."</a>";
$todaycomma = ', ';
}
}
2006-04-22, 06:17 PM
Quote:ok but when i try to add the line to my portal nothing comes up.
make sure you are putting the php code in portal.php above
eval("\$whosonline = \"".$templates->get("portal_whosonline")."\";");
xiaozhu could you send the whole php file
thanks