peterisgb Posted November 18, 2011 Share Posted November 18, 2011 Hi, i'm working on this code and i cant seem to get it to work right, it displays all the images for all the users instead of the selected images for certain, can anyone help me. Lines - 89 - 106 <?php require "globals.php"; 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"); ?> <table border="0" class=table width="100%" cellpading="0" cellspacing="0"> <tr> <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>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> <tr> </table> <table border="0" class=table width="100%" cellpading="0" cellspacing="0"> <tr> <td class=table> <h3></h3> </td> <td class=table> <h3>Gang Tag</h3> </td> <td class=table> <h3><center>User</center></h3> </td> <td class=table> <h3>Last Action</h3> </td> <td class=table> <h3>Time Online</h3> </td> </tr> <?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']) { $donator="VIP:<img src='donator.gif' alt='Donator: {$r['donatordays']} Days Left' title='Donator: {$r['donatordays']} Days Left' />"; } if($r['user_level']==2) { $staff="Staff: <img src='images/admin.gif' alt='Game Staff' />"; } if($r['userid']==1) { $owner=" <img src='images/owner.gif' alt='Game Owner' />"; } $r['username']="<b>$staff $owner $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> <a href='gangs.php?action=view&ID={$r['gang']}'>$gangtag</a> </td> <td class=table> {$r['username']} </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></tr>"; } ?> </td> </tr> </table> <?php $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
peterisgb Posted November 18, 2011 Author Share Posted November 18, 2011 (edited) Uhm.. Seems my settings are screwed. I can not see anything in the code tags =/ removed source Edited November 21, 2011 by illusions Quote Link to comment Share on other sites More sharing options...
Uridium Posted November 18, 2011 Share Posted November 18, 2011 Hope this helps added a fwe extra features for you cos im nice like that lol Now has an Action category that shows whos in hosp whos in jail and if they can be attacked.. <?php require "globals.php"; 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"); ?> <table border="0" class=table width="100%" cellpading="0" cellspacing="0"> <tr> <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>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> <tr> </table> <table border="0" class=table width="100%" cellpading="0" cellspacing="0"> <tr> <td class=table> <h3></h3> </td> <td class=table> <h3>Gang Tag</h3> </td> <td class=table> <h3><center>User</center></h3> </td> <td class=table> <h3>Last Action</h3> </td> <td class=table> <h3>Time Online</h3> </td> <td class=table> <h3>Action</h3> </td> </tr> <?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="VIP:<img src='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/admin.gif' alt='Game Staff' />"; } if($r['user_level']== 1) { $staff=""; } if($r['userid']==1) { $owner=" <img src='images/owner.gif' alt='Game Owner' />"; } $r['username']="<b>$staff $owner $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>"; if ($r['gang'] > 0) { print" <a href='gangs.php?action=view&ID={$r['gang']}'>View Gang</a> </td>"; } else { print" <small>No Gang</small> </td>"; } print" <td class=table> {$r['username']} </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>"; if($r['hospital'] > 0) { print"<td><small>Hospital</small></td>"; } if($r['jail'] > 0) { print"<td><small>Jail</small></td>"; } if($r['hospital'] == 0 AND $r['jail'] == 0) { print"<td><small>[<a href='attack.php?uid={$r['userid']}'>Attack</a>]</td>"; } print"</tr>"; } ?> </td> </tr> </table> <?php $h->endpage(); ?> 1 Quote Link to comment Share on other sites More sharing options...
peterisgb Posted November 18, 2011 Author Share Posted November 18, 2011 (edited) cool, of course i had to tweak it, looking at yours i can now see why it wasnt working lol i like the actions you added in, i didnt think of that lol, for others to add other useful links, find <small>[<a href='viewuser.php?u={$r['userid']}'>View</a>] add underneath [<a href='attack.php?ID={$r['userid']}'>Attack</a>] [<a href='mailbox.php?action=compose&ID={$r['userid']}'>Mail</a>] Thanks :) Edited November 19, 2011 by peterisgb adding others Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.