I have NOT been able to test this fully. Or even more than making sure it has no parse errors and the numbers add up. But, here is the plugin code for this mod for those of you using my spider's on the forumhome page.
The forumhome template code needs to change as well. My target audience will know how to do that
Code:
$datecut24 = TIMENOW - 86400;
$numberregistered24 = 0;
$numberguest24 = 0;
$numberspiders24 = 0;
$forumusers24 = $vbulletin->db->query("
SELECT userid, lastactivity, useragent FROM " . TABLE_PREFIX . "session
WHERE lastactivity > $datecut24
");
$time24 = TIMENOW ;
while ($loggedin24 = $vbulletin->db->fetch_array($forumusers24))
{
$userid24 = $loggedin24['userid'];
if (!$userid24)
{ // Guest or spider
if (!empty($vbulletin->wol_spiders))
{
if (preg_match('#(' . $vbulletin->wol_spiders['spiderstring'] . ')#si', $loggedin24['useragent'], $agent))
{
$numberspiders24++;
}
else
{
$numberguest24++;
}
}
}
else
{
$numberregistered24++;
}
if ($loggedin24['lastactivity'] < $time24)
{
$time24 = $loggedin24['lastactivity'];
}
}
$time24 = TIMENOW - $time24;
$time24 = floor($time24 / 3600) + (($time24 % 3600) ? 1 : 0);
$numbertotal24 = $numberregistered24 + $numberguest24 +$numberspiders24;
unset($loggedin24);
$vbulletin->db->free_result($forumusers24);