Thread: Active Users 09
View Single Post
  #4  
Old 19th February 2023, 07:14
xbdevsponsor xbdevsponsor is offline
Member
 
Join Date: Feb 2023
Canada
Posts: 10
Cool
Code:
$sysops     = get_row_count('users', "WHERE sysop='yes'");
     $superadmins      = get_row_count('users', "WHERE superadmin='yes'");
     $supermoderators = get_row_count('users', "WHERE supermod='yes'");
       $comvip     = get_row_count('users', "WHERE comvip='yes'");
     
 $donorvip     = get_row_count('users', "WHERE donorvip='yes'");
     $warned  = number_format(get_row_count("users", "WHERE warned='no'"));
$irc     = get_row_count('users', "WHERE irc='yes'");
$irc_idle  = number_format(get_row_count("users", "WHERE irc_idle='no'"));
$suspened  = number_format(get_row_count("users", "WHERE suspended='no'"));
phpmyadmin now:
Code:
Alter table users add sysop enum('yes','no') not null default 'no';
Alter table users add superadmin enum('yes','no') not null default 'yes';
Alter table users add supermod enum('yes','no') not null default 'no';
Alter table users add irc enum('yes','no') not null default 'no';
Alter table users add irc_idle enum('yes','no') not null default 'no';
ALTER TABLE users ADD suspended enum('yes','no') not null default 'no';
ALTER TABLE users ADD vip enum('yes','no') not null default 'no';
Alter table users add warned enum('yes','no') not null default 'no';
Above is new features added to this for more ideas as how it works :) good luck

extras:

Code:
$sysops     = get_row_count('users', "WHERE sysop='yes'");
     $superadmins      = get_row_count('users', "WHERE superadmin='yes'");
     $supermoderators = get_row_count('users', "WHERE supermod='yes'");
       $comvip     = get_row_count('users', "WHERE comvip='yes'");
     
 $donorvip     = get_row_count('users', "WHERE donorvip='yes'");
     $warned  = number_format(get_row_count("users", "WHERE warned='no'"));
$irc     = get_row_count('users', "WHERE irc='yes'");
$irc_idle  = number_format(get_row_count("users", "WHERE irc_idle='no'"));
$suspened  = number_format(get_row_count("users", "WHERE suspended='no'"));
phpmyadmin now:
Code:
Alter table users add sysop enum('yes','no') not null default 'no';
Alter table users add superadmin enum('yes','no') not null default 'yes';
Alter table users add supermod enum('yes','no') not null default 'no';
Alter table users add irc enum('yes','no') not null default 'no';
Alter table users add irc_idle enum('yes','no') not null default 'no';
ALTER TABLE users ADD suspended enum('yes','no') not null default 'no';
ALTER TABLE users ADD vip enum('yes','no') not null default 'no';
Alter table users add warned enum('yes','no') not null default 'no';
Above is new features added to this for more ideas as how it works :) good luck

extras:
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) | Super Admin (0) | Administrators (0) | Super Mod (0) | Moderators (0) | V.I.P (0) | ComVIP (0) | Trustee VIP | Scene Trustee | Extreme Users (0) | Power Users (0) | Members (0) | Validating (0) | Suspended (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>";

Last edited by xbdevsponsor; 19th February 2023 at 09:58.
Reply With Quote