Done a little editing tested it works really good for me hope its okay give it a try. p.s im using this for my site thanks.
<?php
require "globals.php";
global $db,$ir,$c,$r,$userid,$h;
if ($_GET['time'])
{
$time=$_GET['time'];
}
else
{
$time=15;
}
$cn=0;
$lk=mysql_query("SELECT * FROM users WHERE laston>unix_timestamp()-1440*60");
$aa=mysql_num_rows($lk);
$ll=mysql_query("SELECT * FROM users WHERE laston>unix_timestamp()-60*60");
$ab=mysql_num_rows($ll);
$lm=mysql_query("SELECT * FROM users WHERE laston>unix_timestamp()-45*60");
$ac=mysql_num_rows($lm);
$ln=mysql_query("SELECT * FROM users WHERE laston>unix_timestamp()-30*60");
$ad=mysql_num_rows($ln);
$lo=mysql_query("SELECT * FROM users WHERE laston>unix_timestamp()-15*60");
$ae=mysql_num_rows($lo);
$he=mysql_query("SELECT * FROM users WHERE laston>unix_timestamp()-1*60");
$hu=mysql_num_rows($he);
$q=mysql_query("SELECT * FROM users WHERE laston>unix_timestamp()-{$time}*60 ORDER BY laston DESC");
?>
<table border="0" class=table width="75%" cellpading="0" cellspacing="1">
<tr style='background:gray'>
<th><h3>Statistics</h3></th>
<th><h3>Time Selecter</h3></th>
<th><h3>Legend</h3></th>
</tr>
<tr style='background:gray'>
<td>
Users online in the last minute: <?php print"{$hu} <br />"; ?>
Users online in the last 15 Minutes: <?php print"{$ae} <br />"; ?>
Users online in the last 30 Minutes: <?php print"{$ad} <br />"; ?>
Users online in the last 45 Minutes: <?php print"{$ac} <br />"; ?>
Users online in the last 60 Minutes: <?php print"{$ab} <br />"; ?>
Users online in the last 24 Hours: <?php print"{$aa} <br />"; ?>
</td>
<td>
<a href='usersonline.php?time=1'>(1 Min)</a><br />
<a href='usersonline.php?time=15'>(15 Mins)</a><br />
<a href='usersonline.php?time=30'>(30 Mins)</a><br />
<a href='usersonline.php?time=45'>(45 Mins)</a><br />
<a href='usersonline.php?time=60'>(60 Mins)</a><br />
<a href='usersonline.php?time=1440'>(24 Hours)</a><br />
</td>
<td>
Admins = <font color = Red>Red</font><br />
Secretaries = <font color = purple>Purple</font><br />
Moderators = <font color = blue>Blue</font><br />
Assistants = <font color = green>Yellow</font><br />
Donators = <img src='images/donator.gif' width='15px' height='15' alt='Donator' /> & <font color = cyan>Cyan</font><br />
</td>
</tr>
</table>
<table border="0" class=table width="75%" cellpading="0" cellspacing="1">
<tr style='background:gray'>
<th><u>No.</u></th>
<th><u>Level</u></th>
<th><u>User</u></th>
<th><u>Last Action</u></th>
<th><u>Time Online</u></th>
<th><u>User Actions</u></th>
</tr><hr />
<?php
while($r=mysql_fetch_assoc($q))
{
$la=time()-$r['laston'];
$unit="secs";
if($la >= 60)
{
$la=(int) ($la/60);
$unit="mins";
}
if($la >= 60)
{
$la=(int) ($la/60);
$unit="hours";
if($la >= 24)
{
$la=(int) ($la/24);
$unit="days";
}
}
$cn++;
$name=$r['username'];
$id=$r['userid'];
$gangtag=$r['yourgangPREF'];
if($r['donatordays'] > 0)
{
$donator="<img src='images/donator.gif' width='15px' height='15' alt='Donator: {$r['donatordays']} Days Left' title='Donator: {$r['donatordays']} Days Left' />";
}
if($r['donatordays'] == 0)
{
$donator="";
}
if($r['user_level']== 2)
{
$staff="Administrator";
}
if($r['user_level']== 3)
{
$staff="Secretary";
}
if($r['user_level']== 4)
{
$staff="Assistant";
}
if($r['user_level']== 5)
{
$staff="Moderator";
}
if($r['user_level']== 1)
{
$staff="Member";
}
if($r['donatordays'] > 0)
{
$donator="<img src='images/donator.gif' width='15px' height='15' alt='Donator: {$r['donatordays']} Days Left' title='Donator: {$r['donatordays']} Days Left' />";
}
if($r['donatordays'] == 0)
{
$donator="";
}
if($r['user_level']== 2)
{
$name="<font color=red>$name</font>";
}
if($r['user_level']== 3)
{
$name="<font color=purple>$name</font>";
}
if($r['user_level']== 4)
{
$name="<font color=green>$name</font>";
}
if($r['user_level']== 5)
{
$name="<font color=blue>$name</font>";
}
if($r['user_level']== 1)
{
$name="<font>$name</font>";
}
if($r['donatordays'] > 0 & $r['user_level']== 1)
{
$name="<font color=cyan>$name</font>";
}
$r['username']="<a href='viewuser.php?u={$r['userid']}'>$name $donator [$id]</a> | <b>$staff</b>";
print "<tr style='background:gray'>
<td><center>$cn.</center></td>
<td><center>Level: {$r['level']}</center></td>
<td><center>{$r['username']}</center></td>";
print "</td>
<td><center>($la $unit)</center></td>";
$lb=time()-$r['last_login'];
$units="secs";
if($lb >= 60)
{
$lb=(int) ($lb/60);
$units="mins";
}
if($lb >= 60)
{
$lb=(int) ($lb/60);
$units="hours";
if($lb >= 24)
{
$lb=(int) ($lb/24);
$units="days";
}
}
if($r['laston'] <= time()-60*60)
{
$lb="Offline";
$unit="";
}
print "<td><center>{$lb} {$units}</center></td>";
if($r['hospital'] > 0) {
print"<td><center>
[<a href='mailbox.php?action=compose&ID={$r['userid']}'><font color='{$r['colour']}'>Mail</font></a>]
(In Hospital) </center></td>";
}
if($r['jail'] > 0) {
print"<td><center>
[<a href='mailbox.php?action=compose&ID={$r['userid']}'><font color='{$r['colour']}'>Mail</font></a>]
(In Jail) </center></td>";
}
if($r['hospital'] == 0 AND $r['jail'] == 0) {
print"<td><center>
[<a href='attack.php?ID={$r['userid']}'><font color='{$r['colour']}'>Attack</font></a>] |
[<a href='mailbox.php?action=compose&ID={$r['userid']}'><font color='{$r['colour']}'>Mail</font></a>]
</center></td>";
}
print"</tr>";
}
?>
</td>
</tr>
</table><hr />
<?php
$h->endpage();
?>