Online Users Page [RevCMS/UberCMS/IlluminiaCMS]

zMagenta

Posting Freak
Jul 15, 2011
1,414
682
Hi there!

As you may know, I owned my hotels with a good online users page. It shows the users, changing their username colour depending on their rank, and then also, for rank x+ (x = whatever you choose it to be), it will show the IP Registered and IP Last used - so it's easy to identify what users are multi accounting.

This is the page, sorry, I can't put this online therefore I cannot show you the username feature.



All you need to do is run these SQL queries.
Code:
DROP TABLE IF EXISTS `site_user_color`;
CREATE TABLE `site_user_color` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `rankid` int(11) NOT NULL,
  `color` varchar(6) DEFAULT NULL,
  `is_bold` enum('0','1') DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
 
-- ----------------------------
-- Records of site_user_color
-- ----------------------------
INSERT INTO `site_user_color` VALUES ('1', '1', '000000', '0');
INSERT INTO `site_user_color` VALUES ('2', '2', 'F6D8CE', '1');
INSERT INTO `site_user_color` VALUES ('3', '3', '3971A8', '1');
INSERT INTO `site_user_color` VALUES ('4', '4', 'B404AE', '1');
INSERT INTO `site_user_color` VALUES ('5', '5', '40FF00', '1');
INSERT INTO `site_user_color` VALUES ('6', '6', 'B40431', '1');
INSERT INTO `site_user_color` VALUES ('7', '7', 'B40431', '1');
INSERT INTO `site_user_color` VALUES ('8', '8', '0404B4', '1');
INSERT INTO `site_user_color` VALUES ('9', '9', '3B240B', '1');
INSERT INTO `site_user_color` VALUES ('10', '10', 'FF0000', '1');
INSERT INTO `site_user_color` VALUES ('11', '11', '000000', '1');
INSERT INTO `site_user_color` VALUES ('12', '12', '0404B4', '1');
INSERT INTO `site_user_color` VALUES ('13', '13', '000000', '0');

Then, just add this PHP into any page.

PHP:
<div id="container">
    <div id="content">
    <div id="column2" class="column">
<div class="habblet-container ">
                <div class="box-content1">
                        <div class="cbb clearfix blue ">
 
                            <h2 class="title">What is this page?
                            </h2>
                        <div style="padding:5px">
                    <p>This page shows all of the online users; with a colour code next to their name. Below are what the colour means;<br></br>
                    Normal User - <font color="#000000">This colour</font><br>
                    Low VIP - <font color="#F6D8CE"><b>This colour</font></b><br>
                    High VIP - <font color="#3971A8"><b>This colour</font></b><br>
                    Legend VIP - <font color="#B404AE"><b>This colour</font></b><br>
                    eXpert - <font color="#40FF00"><b>This colour</font></b><br>
                    Moderator - <font color="#B40431"><b>This colour</font></b><br>
                    Manager - <font color="#0404B4"><b>This colour</font></b><br>
                    Owner - <b>This colour</b><br>
                 
</div></div></div></div>
 
 
</div>
 
                              <div id="column1" class="column">
 
 
<div class="habblet-container ">
<div class="cbb clearfix red ">
 
 
<h2 class="title">All Online Users</h2>
<div style="padding:5px;">
 
Average users: {average}<br />
{online} user(s) online!, the users are;<br />
<?php
$queryUserList = mysql_query("SELECT * FROM users WHERE online = '1' ORDER BY id ASC");
 
$allowedRank = '7';
$queryRank = mysql_query("SELECT rank FROM users WHERE id = '".$_SESSION['user']['id']."'");
$currentRank = mysql_result($queryRank, 0);
?>
 
<table <?php if($currentRank >= $allowedRank){ echo "border=\"1\""; }?>>
 
<?php
while($row = mysql_fetch_array($queryUserList))
{
    echo "<tr>";
 
    $queryColor = mysql_query("SELECT color,is_bold FROM site_user_color WHERE rankid = '".$row['rank']."'");
    while($rowRank = mysql_fetch_array($queryColor))
    {
        if ($rowRank['is_bold'] == 1)
        {
            $isBold = "font-weight: bold;";
        }
        else
        {
            $isBold= "";
        }
        echo "<td><font style=\"color:#".$rowRank['color']."; ".$isBold."\">". $row['username'] . "</font></td>";
    }
    if ($currentRank >= $allowedRank)
    {
        echo "<td><b>IP Last:</b> " . $row['ip_last'] . "</td>";
        echo "<td><b>IP on registration:</b> " . $row['ip_reg'] . "</td>";
    }
 
    echo "</tr>";
}
?>
</table>

Also, quick note,
PHP:
$allowedRank = '7';
7 = the rank+ that an see the IP's, enjoy!

(Thanks for helping out with this)
 

zMagenta

Posting Freak
Jul 15, 2011
1,414
682
Pretty, could you post a screenie of it in action?


20b4kBO.png


If anyones using this, willing to post a screenshot of it in action!
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
To add on, when you are staff it shows the table border - not when you are a normal member.
 

Users who are viewing this thread

Top