This is the solution to all your registered users being in the Control Panel... which is a bit alarming at first glance.
The online location when you are in the Control Panel is null, not blank, so this solves it.
PHP Code:
if ($online[location] = " ") {
PHP Code:
if (!$online[location]) {
OK, now someone want to trade me and show how what you did to show the IP address?
By the way, NTLDR is the GREATEST! I am a person who likes simplicity, and your hacks make things that appear to be complex, end up being simple. Thanks for contributing your work!
OK, scratch my last trade comment... here is the code WITH the location fixed for registered users, and the IP address added...there are too many changes to list them, given the total size. I'm going to make a final edit that I won't upload, because it deviates from the spirit of the original code. If anyone wants it, let me know. I'm going to kill the IP column, and just replace "Guest" with their IP address. That will eliminate a column, and I don't care about IP addresses for registered users anyway. If anyone wants it, i'll post it.
PHP Code:
$datecut = time()-$cookietimeout;
$onlineusers = mysql_query("SELECT DISTINCT username,location,session.lastactivity,session.host,usergroupid FROM user,session WHERE session.userid=user.userid AND session.lastactivity>$datecut ORDER BY username ASC");
echo "<br><br><table width=\"90%\" align=\"center\" border='0' cellpadding='0' cellspacing='0' class='tblborder'><tr><td>";
echo "<table width=\"100%\" border=0 cellspacing=1 cellpadding=4><tr class='tblhead'><td align=\"center\" colspan=4 width=\"100%\"><b><span class='tblhead'>Who's Online</span></b></td></tr>\n";
echo "<tr class='".getrowbg()."'><td nowrap align=\"center\"><font size='1'><b>Username</b></font></td><td align=\"center\" nowrap><font size='1'><b>Location</b></font></td><td align=\"center\" nowrap><font size='1'><b>Host IP</b></font></td><td align=\"center\" nowrap><font size='1'><b>Last Active</b></font></td></tr>\n";
while ($online=$DB_site->fetch_array($onlineusers)) {
if (!$online[location]) {
$online[location] = "Control Panel";
}
if ($online['usergroupid'] == 6) {
$username = "<b><i>$online[username]</i></b>";
} else if ($online['usergroupid'] == 5) {
$uusername = "<b>$user[username]</b></font>";
} else {
$username = $online[username];
}
$lastactivity=vbdate($timeformat,$online[lastactivity]);
echo "<tr class='".getrowbg()."'><td nowrap><a href=\"../member.php?s=$session[sessionhash]&action=getinfo&username=$online[username]\" target=_blank>$username</a></td><td nowrap>$online[location]</td><td nowrap>$online[host]</td><td nowrap>$lastactivity</td></tr>";
}
$onlineguests = mysql_query("SELECT DISTINCT location,lastactivity, host FROM session WHERE userid=0 AND session.lastactivity>$datecut ORDER BY host ASC");
while ($onlineg=$DB_site->fetch_array($onlineguests)) {
$lastguestactivity=vbdate($timeformat,$onlineg[lastactivity]);
echo "<tr class='".getrowbg()."'><td nowrap>Guest</td><td nowrap>$onlineg[location]</td><td nowrap>$onlineg[host]</td><td nowrap>$lastguestactivity</td></tr>";
}
echo "</table></td></tr></table>";