Bravo List
Register
Go Back   > Bravo List > Source Code > Trackers > TBDev > Mods & Themes
Reply
  #1  
Old 04-10-18, 11:58
BamBam0077's Avatar
BamBam0077 BamBam0077 is offline
Support
 
Join Date: Jul 2013
P2P
Posts: 287
Smile Active Users 09
Click the image to open in full size.


Code:
    //==09 users on index
    $active3 ="";
    $file = "./cache/active.txt";
    $expire = 30; // 30 seconds
    if (file_exists($file) && filemtime($file) > (time() - $expire)) {
    $active3 = unserialize(file_get_contents($file));
    } else {
    $dt = sqlesc(time() - 180);
    $active1 = sql_query("SELECT id, username, class, warned, donor FROM users WHERE last_access >= $dt ORDER BY class DESC") or sqlerr(__FILE__, __LINE__);
        while ($active2 = mysqli_fetch_assoc($active1)) {
            $active3[] = $active2;
        }
        $OUTPUT = serialize($active3);
        $fp = fopen($file, "w");
        fputs($fp, $OUTPUT);
        fclose($fp);
    } // end else
    $activeusers = "";
    if (is_array($active3))
    foreach ($active3 as $arr) {
        if ($activeusers) $activeusers .= ",\n";
        $activeusers .= "<span style=\"white-space: nowrap;\">"; 
        $arr["username"] = "<font color='#" . get_user_class_color($arr['class']) . "'> " . htmlspecialchars($arr['username']) . "</font>";
        $donator = $arr["donor"] === "yes";
        $warned = $arr["warned"] === "yes";
     
        if ($CURUSER)
            $activeusers .= "<a href='{$TBDEV['baseurl']}/userdetails.php?id={$arr["id"]}'><b>{$arr["username"]}</b></a>";
        else
            $activeusers .= "<b>{$arr["username"]}</b>";
        if ($donator)
             $activeusers .= "<img src='{$TBDEV['pic_base_url']}star.gif' alt='Donated' />";
        if ($warned)
            $activeusers .= "<img src='{$TBDEV['pic_base_url']}warned.gif' alt='Warned' />";
        $activeusers .= "</span>";
    }
     
    if (!$activeusers)
        $activeusers = "{$lang['index_noactive']}";
 
      echo "<div style='margin-top: -10px;margin-left: -25px;text-align:left;max-width: 901px;padding: 1em;' class='mCol'>
            <div class='myBlock'><div style='margin-top:  5px;'>
            <div class='myBlock-cap'><span style='font-weight:bold;font-size:12pt;'>{$lang['index_active']}</span></div></div>
            <div style='padding: 5px;margin-top: -3px;margin-left: 0px;max-width:  900px;box-shadow: inset 0 1px 0 rgba(255, 255, 255,  0.2);'></div>
            <div style='margin-top: -5px;text-align: center;color: #b9b9b9;'>
            Owners (0) | Administrators (0) | Moderators (0) | V.I.P (0) | Power Users (0) | Members (0) | Validating (0)
            </div>";
      echo "<table style='margin-top: 5px;border: 1px solid  #222;color: #b9b9b9;' border='0' cellpadding='10' cellspacing='0' width='100%'>
            <tr class='table'>
            <td class='text'>{$activeusers}</td>
            </tr></table></div><div style='margin-top:  -17px;'></div>";
Code:
.myBlock {
    display: block;
    background-color: #151515;
    background-repeat: repeat-x;
    background-position: top;
    width: 100%;
    border: 1px solid #222;
    margin: 0px;
    padding: 0px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.2);         
}
.myBlock-cap {
    display: block;
    padding-right: 10px;
    padding-left: 10px;
    font-size: 14px;
    font-weight: bold;
    color: #FFF;
    margin-left: 0px;
    background-color: #333333;
    line-height: 200%;
    position: relative;
    bottom: 4px
}
.myBlock-con {
    display: block;
    padding: 7px;
}
replace old code:
Code:
Owners (0) | Administrators (0) | Moderators (0) | V.I.P (0) | Power Users (0) | Members (0) | Validating (0)
new code:
Code:
Owners ({$owners}) | Administrators ({$admins}) | Moderators ({$moderator}) | V.I.P ({$donors}) | Power Users ({$power}) | Members ({$members}) | Validating ({$unverified})
Add below:
Code:
    if (!$activeusers)
        $activeusers = "{$lang['index_noactive']}";
New Code:
Code:
     $owners      = get_row_count('users', "WHERE owners='yes'");
     $admins      = get_row_count('users', "WHERE admin='yes'");
     $moderator   = get_row_count('users', "WHERE moderator='yes'");     
     $donors      = get_row_count('users', "WHERE donor='yes'");
     $power       = get_row_count('users', "WHERE poweruser='yes'");
     $members     = get_row_count('users', "WHERE members='yes'");
     $unverified = number_format(get_row_count("users", "WHERE status='pending'"));
phpmyadmin now:
Code:
ALTER TABLE users ADD owners enum('yes','no') not null default 'no';
ALTER TABLE users ADD admin enum('yes','no') not null default 'no';
ALTER TABLE users ADD moderator enum('yes','no') not null default 'no';
ALTER TABLE users ADD poweruser enum('yes','no') not null default 'no';
ALTER TABLE users ADD members enum('yes','no') not null default 'yes';

Click the image to open in full size.

Last edited by BamBam0077; 04-10-18 at 12:43. Reason: added new updates (:
Reply With Quote
  #2  
Old 31-01-19, 19:15
Napon's Avatar
Napon Napon is offline
Senior Member
 
Join Date: Feb 2016
P2P
Posts: 345
Default
No good mod
__________________
Reply With Quote
  #3  
Old 01-02-19, 21:37
elvira's Avatar
elvira elvira is offline
Senior Member
 
Join Date: Jan 2008
Slovenia
Posts: 108
Default
Quote:
Originally Posted by Napon View Post
No good mod
and why not, on your page we must pay, here is free….
Reply With Quote
Reply

Tags
09 , active , users

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 22:30. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2019, vBulletin Solutions Inc.