".(ctime()-$time).' ORDER BY '.($sort=='IP'&&$isadmin?'lastip':'lastactivity DESC'));
$guests=mysql_query('SELECT ip,date,lasturl FROM guests WHERE date>'.(ctime()-$time).' ORDER BY '.($sort=='IP'&&$isadmin?'ip':'date').' DESC');
$server=getenv('SERVER_NAME');
$port=getenv('SERVER_PORT');
$host=$server;
$lnk='During last minute |
$lnk=300>During last 5 minutes |
$lnk=900>During last 15 minutes |
$lnk=3600>During last hour |
$lnk=86400>During last day
";
if($isadmin)
print ' | Sort by ".($sort=='IP'?'date':'IP')."";
print "
$fonttag Online users during the last $time seconds:
$tblstart
$tccellh width=20> 
$tccellh>Username
$tccellh width=80> Last activity
$tccellh width=130> Last post
$tccellh>URL
";
if($isadmin) print "$tccellh width=100>IP address";
print "$tccellh width=60> Posts
";
for($i=1;$user=mysql_fetch_array($posters);$i++){
if($i>1) print '
';
$namecolor=getnamecolor($user[sex],$user[powerlevel]);
$user[lastposttime]=date($dateformat,$user[lastposttime]+$tzoff);
if(!$user[posts]) $user[lastposttime]='-------- --:-- --';
$user[lasturl]=str_replace('<','<',$user[lasturl]);
$user[lasturl]=str_replace('>','>',$user[lasturl]);
$user[lasturl]=str_replace('%20',' ',$user[lasturl]);
print "
$tccell1>$i
$tccell2l>$user[name]
$tccell1>".date('h:i A',$user[lastactivity]+$tzoff)."
$tccell1>$user[lastposttime]
".($user[lasturl]=='IP banned'?"$tccell2l>IP banned":"
$tccell2l>$user[lasturl]
");
if($isadmin) print "$tccell1>$user[lastip]";
print "$tccell2>$user[posts]";
}
print "
$tblend
$fonttag
Guests:
$tblstart
$tccellh width=20> 
$tccellh width=150> 
$tccellh width=80>Last activity
$tccellh>URL
";
if($isadmin) print "$tccellh width=100> IP address";
print '';
for($i=1;$guest=mysql_fetch_array($guests);$i++){
if($i>1) print "
";
$guest[lasturl]=str_replace('<','<',$guest[lasturl]);
$guest[lasturl]=str_replace('>','>',$guest[lasturl]);
print "
$tccell1>$i
$tccell2> 
$tccell1>".date('h:i A',$guest[date]+$tzoff)."
".($guest[lasturl]=='IP banned'?"$tccell2l>IP banned":"
$tccell2l>$guest[lasturl]
");
if($isadmin) print "$tccell1>$guest[ip]";
}
print $tblend.$footer;
printtimedif($startingtime);
?>