Really nice idea for a block, decided to add it to my site, but noticed there were some problems.
Here's some better code that doesnt guess table names, hides invisible users, and doesnt show 'Anonymous'
PHP Formatted Code
function phpblock_5latest
()
{
global $_CONF, $_TABLES;
$list = "";
$quer = mysql_query ("SELECT u.uid,u.lastlogin,p.showonline FROM {$_TABLES['userinfo']} AS u, {$_TABLES['userprefs']} AS p WHERE u.uid = p.uid AND u.uid != '1' AND p.showonline = '1' ORDER BY lastlogin DESC limit 5");
while ($line = mysql_fetch_array($quer)){
$uidsql= mysql_query ("SELECT username,photo FROM {$_TABLES['users']} WHERE uid=$line[uid]");
$uidresult = DB_fetchArray
($uidsql);
$lastlogin = DB_getItem
($_TABLES['userinfo'], 'lastlogin', "uid = $line[uid]");
$lasttime = COM_getUserDateTimeFormat
($lastlogin);
$list = $list.'<a href="'.$_CONF["site_url"].'/users.php?mode=profile&uid='.$line["uid"].'" title="'.$lasttime[0].'">'.$uidresult[username];
if ($uidresult[photo] != ""){
$list = $list.' <img src="'.$_CONF['layout_url'].'/images/smallcamera.gif" border="0" alt="">';
}
$list = $list.'</a><br>';
}
return $list;
}