Ok i have made a usersonline page, its really good i think,
Its Defo needs cleaning up. :s i'm abit of a messy worker.
usersonline.php
<?php
require "globals.php";
global $db,$ir,$c,$r,$userid,$h;
$db->query("UPDATE users SET lastpage='Users Online' WHERE userid=$userid");
$urlRefresh = "usersonline.php";
header("Refresh: 30; URL=\"" . $urlRefresh . "\""); // redirect in 30 seconds
if ($_GET['time'])
{
$time=$_GET['time'];
}
else
{
$time=60;
}
$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");
?>
<center><a id='button1a' href='usersonline.php'>Manual Refresh</a></center>
<table border="0" class=table width="100%" cellpading="0" cellspacing="0">
<tr>
<td class=table>
<h3>Statistics</h3>
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 hour: <?php print"{$ab}"; ?><br />
Users online in the last 24 hours: <?php print"{$aa}"; ?><br />
</td>
<td class=table>
<h3>Time Selecter</h3>
<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 class=table>
<h3>Legend</h3>
<img src='images/admin.gif' alt='Game Owner' /> - Game Owner<br />
<img src='images/owner.gif' alt='Game Staff' /> - Game Staff<br />
<img src='images/donator.gif' alt='Donator' /> - Donators<br />
<img src='specialdonator.gif' alt='Donator' /> - Top Donators<br />
</td>
<tr>
</table>
<table border="0" class=table width="100%" cellpading="0" cellspacing="0">
<tr>
<td class=table>
<h3></h3>
</td>
<td class=table>
<h3>Level</h3>
</td>
<td class=table>
<h3><center>User</center></h3>
</td>
<td class=table>
<h3>Rate</h3>
</td>
<td class=table>
<h3>Last Page Viewed</h3>
</td>
<td class=table>
<h3>Last Action</h3>
</td>
<td class=table>
<h3>Time Online</h3>
</td>
<td class=table>
<h3>-</h3>
</td>
<td class=table>
<h3>Action</h3>
</td>
</tr><br /><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'];
$gangtag=$r['yourgangPREF'];
if($r['donatordays'] > 0)
{
$donator="<img src='images/donator.gif' alt='Donator: {$r['donatordays']} Days Left' title='Donator: {$r['donatordays']} Days Left' />";
}
if($r['donatordays'] == 0)
{
$donator="";
}
if($r['user_level']== 2)
{
$staff="<img src='images/owner.gif' alt='Game Staff' alt='Admins' title='Admin'/>";
}
if($r['user_level']== 3)
{
$staff="<img src='images/owner.gif' alt='Game Staff' alt='Staff' title='Secretary'/>";
}
if($r['user_level']== 4)
{
$staff="<img src='images/owner.gif' alt='Game Staff' alt='Staff' title='Forum Moderator'/>";
}
if($r['user_level']== 5)
{
$staff="<img src='images/owner.gif' alt='Game Staff' alt='Staff' title='Assistant'/>";
}
if($r['user_level']== 1)
{
$staff="";
}
if($r['userid']==1)
{
$staff="<img src='images/admin.gif' title='Owner'/><img src='images/owner.gif' title='Staff'/>";
}
$r['username']="<b>$staff $donator<a href='viewuser.php?u={$r['userid']}'><font color='{$r['colour']}'> $name</b></font></a>";
print "<tr>
<td class=table>
$cn.
</td>
<td class=table>
({$r['level']})
</td>
<td class=table>
{$r['username']} ({$r['userid']})
</td>
<td class=table bgcolor='#000000'>
<a href=rating.php?change=up&ID={$r['userid']}><img src=positive.gif height='12' width='12'></a>
<font size='2' color='yellow'><b>{$r['rating']}</b></font>
<a href=rating.php?change=down&ID={$r['userid']}><img src=negative.gif height='12' width='12'></a>
</td>
<td>";
if($r['pageprivacy'] == 1)
{
print "<a href='donator.php'><font color='{$r['colour']}'><b>Donator Privacy</b></font></a>";
}
else
{
print "<a href='{$r['lastpage']}'><font color='{$r['colour']}'><b>{$r['lastpage']}</b></font></a>";
}
print "";
if($ir['user_level'] == 2)
{
print "(<small><b>{$r['lastpage']}</b></small>)";
}
else
{
print "";
}
print "</td>
<td class=table>
($la $unit)
</td>
<td class=table>";
$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 "{$lb} {$units}</td>
<td>";
$zom=$db->query("SELECT * FROM hvzstats");
$hvz=$db->fetch_row($zom);
if($ir['user_level'] > 1)
{
if($hvz['hvz'] ==1)
{
if($r['humanorzombie'] == 1) { $zomb="<font color='red'><b>(Z)</b></font>";}
if($r['humanorzombie'] == 0) { $zomb="<font color='#33CC33'><b>(H)</b></font>"; }
$ztext= "Status: $zomb
$kills";
}
}
print "
$zomb
</td>
";
if($r['hospital'] > 0) {
print"<td> <small>
[<a href='nudge.php?ID={$r['userid']}'><font color='{$r['colour']}'>Nudge</font></a>]
[<a href='mailbox.php?action=compose&ID={$r['userid']}'><font color='{$r['colour']}'>Mail</font></a>]
In Hospital</small> </td>";
}
if($r['jail'] > 0) {
print"<td><small>
[<a href='nudge.php?ID={$r['userid']}'><font color='{$r['colour']}'>Nudge</font></a>]
[<a href='mailbox.php?action=compose&ID={$r['userid']}'><font color='{$r['colour']}'>Mail</font></a>]
In Jail</small> </td>";
}
if($r['hospital'] == 0 AND $r['jail'] == 0) {
print"<td>
<small>
[<a href='nudge.php?ID={$r['userid']}'><font color='{$r['colour']}'>Nudge</font></a>]
[<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>]</small>
</td>
";
}
print"</tr>";
}
?>
</td>
</tr>
</table><hr />
<table width=75% border=3 bordercolor=#BDBDBD cellspacing=0 bgcolor=#FBFBE0 frame=border rules=none>
<tr>
<td width=75>
<img src=lightbulb.gif><br>
<font color=#999999><i>[<a href=preferences.php><font color=#999999><i>Turn Off</i></font></a>]</i></font>
</center>
</td>
<td>
<center>
<b>Users Online</b>
</center>
<font color=#000000 size=2>
<u><b>Note</b></u><br />
This Page AutoRefreshes Every 30 Seconds<br />
Click [<a href="helponlinerefresh.php"><font color='red'>HERE</font></a>] to find out out why this page AutoRefreshes every 30 seconds.
</font></td></tr></table><br>
<?php
$h->endpage();
?>
The Users Online page has.
Owner Image,
Staff Image,
Donator Image,
Donator Privacy, (LINK)
Last Page View, (LINK)
Admin Auto Bypass Donator Privacy,
Good Layout Etc,
Mods you will need to make this work 100%.
Rating Mod,
Nugde Mod,
Human VS Zombie (Optional).
thanks,