How many client in server group

gameover16

Member
Jul 6, 2016
16
0
51
Hello R4P3.NET community

I need a script to echo the number of client in specific server group
Example
0c2ed7dfb7d64661a1b4a0bcb418d113.png

The original source of the image http://ts.forcenet.cf/panel/
 

Norvik

Retired Staff
Contributor
Jul 18, 2015
635
588
157
Do you want the php code to echo the the amount of members or do you also need the css and stuff to display it?
 

Norvik

Retired Staff
Contributor
Jul 18, 2015
635
588
157
Is that an acceptable result? The circle looks kinda weird but I guess it's okay. I'm gonna improve it if anybody has a suggestion.

cB02vdT.png
 

0x0539

Retired Staff
Contributor
Jan 30, 2016
1,334
1,214
254
Is that an acceptable result? The circle looks kinda weird but I guess it's okay. I'm gonna improve it if anybody has a suggestion.

cB02vdT.png
Looks awesome, you've been doing god's work in the past day(s). :oops:
 

Norvik

Retired Staff
Contributor
Jul 18, 2015
635
588
157
You can get the ts3admin.class.php here.
Code:
<?php
require("ts3admin.class.php");
/*-------SETTINGS-------*/
$ts3_ip = '127.0.0.1';
$ts3_queryport = 10011;
$ts3_user = 'serveradmin';
$ts3_pass = '';
$ts3_port = 9987;
$ts3_name = 'R4P3.NET';

$cfg['groups'] = array(1, 2, 3);
/*----------------------*/


$tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);

if($tsAdmin->getElement('success', $tsAdmin->connect())) {
   $tsAdmin->login($ts3_user, $ts3_pass);
   $tsAdmin->selectServer($ts3_port);
    $tsAdmin->setName($ts3_name);

  
}else{
   die('Connection could not be established.');
}
?>
<!DOCTYPE html>
<html>
<head>
   <style>
    * {
   margin: 0;
   padding: 0;
   cursor: default;
    }

    ::selection {
        text-shadow: 0 1px 0 rgba(0, 0, 0, 0.75) !important;
        color: #fff;
        background-color: transparent;
    }

    *:focus {outline:0;}

    body {
        background-color: #dde0e3;
        font-size: 12px;
        font-family: Tahoma,Helvetica,Arial,sans-serif;
        color: rgb(71,75,81);
        word-wrap: break-word;
        line-height: 1.28;
    }

    .content {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        -webkit-transform: translateX(-50%);
        padding-right: 5px;
        padding-left: 5px;
        margin: 0;
        max-width: 800px;
        box-sizing: border-box;
        text-align: center;
    }

    .box {
        background: rgb(250,250,251) repeat-x top;
        padding: 10px;
        border: 1px solid rgb(206,210,216);
        margin: 3px;
        box-shadow: rgba(0,0,0,0.05) 0px 1px 3px;
        border-radius: 4px;
        width: 200px;
        float: left;
    }

    .box-title {
        font-weight: bold;
        color: rgb(60,65,75);
        background-color: rgb(235,236,239);
        padding: 10px;
        margin: -10px -10px 10px;
        border-bottom: 1px solid rgb(206,210,216);
        border-top-left-radius: 3px;
        border-top-right-radius: 3px;
        background-image: -moz-linear-gradient(top,rgba(255,255,255,0.35) 0%,rgba(255,255,255,0) 100%);
        background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0%,rgba(255,255,255,.35)),color-stop(100%,rgba(255,255,255,0)));
        background-image: -webkit-linear-gradient(top,rgba(255,255,255,.35) 0%,rgba(255,255,255,0) 100%);
        background-image: -o-linear-gradient(top,rgba(255,255,255,.35) 0%,rgba(255,255,255,0) 100%);
        background-image: -ms-linear-gradient(top,rgba(255,255,255,.35) 0%,rgba(255,255,255,0) 100%);
        background-image: linear-gradient(to bottom,rgba(255,255,255,.35) 0%,rgba(255,255,255,0) 100%);
        box-shadow: inset rgba(255,255,255,0.7) 0px 1px 0px;
        text-shadow: rgba(255,255,255,0.9) 0px 1px 0px;
        text-align: center;
    }

    .circle {
        border-radius: 50%;
        width: 45px;
        height: 45px;
        padding: 10px;
        border: 1px solid rgb(206,210,216);
        color: rgb(60,65,75);
        text-align: center;
        font: 33px Tahoma, sans-serif;
        box-shadow: inset rgba(255,255,255,0.7) 0px 1px 0px;
        text-shadow: rgba(255,255,255,0.9) 0px 1px 0px;
        background-image: linear-gradient(to bottom,rgba(255,255,255,.35) 0%,rgba(255,255,255,0) 100%);
        margin-left: auto;
        margin-right: auto;
    }
    </style>
</head>
<body>
    <div class="content">
        <?php
        foreach($cfg['groups'] as $groupID){
            echo '<div class="box">';
            foreach($tsAdmin->serverGroupList()['data'] as $serverGroup){
                if($serverGroup['sgid'] == $groupID){
                    echo '<div class="box-title">'.$serverGroup['name'].'</div>';
                }
            }
        echo '<div class="circle">'.count($tsAdmin->serverGroupClientList($groupID, $names = false)['data'])."</div></div>";
        } ?></div>
    </div>
</body>
</html>
 

gameover16

Member
Jul 6, 2016
16
0
51
You can get the ts3admin.class.php here.
Code:
<?php
require("ts3admin.class.php");
/*-------SETTINGS-------*/
$ts3_ip = '127.0.0.1';
$ts3_queryport = 10011;
$ts3_user = 'serveradmin';
$ts3_pass = '';
$ts3_port = 9987;
$ts3_name = 'R4P3.NET';

$cfg['groups'] = array(1, 2, 3);
/*----------------------*/


$tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);

if($tsAdmin->getElement('success', $tsAdmin->connect())) {
   $tsAdmin->login($ts3_user, $ts3_pass);
   $tsAdmin->selectServer($ts3_port);
    $tsAdmin->setName($ts3_name);

 
}else{
   die('Connection could not be established.');
}
?>
<!DOCTYPE html>
<html>
<head>
   <style>
    * {
   margin: 0;
   padding: 0;
   cursor: default;
    }

    ::selection {
        text-shadow: 0 1px 0 rgba(0, 0, 0, 0.75) !important;
        color: #fff;
        background-color: transparent;
    }

    *:focus {outline:0;}

    body {
        background-color: #dde0e3;
        font-size: 12px;
        font-family: Tahoma,Helvetica,Arial,sans-serif;
        color: rgb(71,75,81);
        word-wrap: break-word;
        line-height: 1.28;
    }

    .content {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        -webkit-transform: translateX(-50%);
        padding-right: 5px;
        padding-left: 5px;
        margin: 0;
        max-width: 800px;
        box-sizing: border-box;
        text-align: center;
    }

    .box {
        background: rgb(250,250,251) repeat-x top;
        padding: 10px;
        border: 1px solid rgb(206,210,216);
        margin: 3px;
        box-shadow: rgba(0,0,0,0.05) 0px 1px 3px;
        border-radius: 4px;
        width: 200px;
        float: left;
    }

    .box-title {
        font-weight: bold;
        color: rgb(60,65,75);
        background-color: rgb(235,236,239);
        padding: 10px;
        margin: -10px -10px 10px;
        border-bottom: 1px solid rgb(206,210,216);
        border-top-left-radius: 3px;
        border-top-right-radius: 3px;
        background-image: -moz-linear-gradient(top,rgba(255,255,255,0.35) 0%,rgba(255,255,255,0) 100%);
        background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0%,rgba(255,255,255,.35)),color-stop(100%,rgba(255,255,255,0)));
        background-image: -webkit-linear-gradient(top,rgba(255,255,255,.35) 0%,rgba(255,255,255,0) 100%);
        background-image: -o-linear-gradient(top,rgba(255,255,255,.35) 0%,rgba(255,255,255,0) 100%);
        background-image: -ms-linear-gradient(top,rgba(255,255,255,.35) 0%,rgba(255,255,255,0) 100%);
        background-image: linear-gradient(to bottom,rgba(255,255,255,.35) 0%,rgba(255,255,255,0) 100%);
        box-shadow: inset rgba(255,255,255,0.7) 0px 1px 0px;
        text-shadow: rgba(255,255,255,0.9) 0px 1px 0px;
        text-align: center;
    }

    .circle {
        border-radius: 50%;
        width: 45px;
        height: 45px;
        padding: 10px;
        border: 1px solid rgb(206,210,216);
        color: rgb(60,65,75);
        text-align: center;
        font: 33px Tahoma, sans-serif;
        box-shadow: inset rgba(255,255,255,0.7) 0px 1px 0px;
        text-shadow: rgba(255,255,255,0.9) 0px 1px 0px;
        background-image: linear-gradient(to bottom,rgba(255,255,255,.35) 0%,rgba(255,255,255,0) 100%);
        margin-left: auto;
        margin-right: auto;
    }
    </style>
</head>
<body>
    <div class="content">
        <?php
        foreach($cfg['groups'] as $groupID){
            echo '<div class="box">';
            foreach($tsAdmin->serverGroupList()['data'] as $serverGroup){
                if($serverGroup['sgid'] == $groupID){
                    echo '<div class="box-title">'.$serverGroup['name'].'</div>';
                }
            }
        echo '<div class="circle">'.count($tsAdmin->serverGroupClientList($groupID, $names = false)['data'])."</div></div>";
        } ?></div>
    </div>
</body>
</html>
thank you :rolleyes:
 

Umar

Member
Jun 18, 2016
65
8
40
You can get the ts3admin.class.php here.
Code:
<?php
require("ts3admin.class.php");
/*-------SETTINGS-------*/
$ts3_ip = '127.0.0.1';
$ts3_queryport = 10011;
$ts3_user = 'serveradmin';
$ts3_pass = '';
$ts3_port = 9987;
$ts3_name = 'R4P3.NET';

$cfg['groups'] = array(1, 2, 3);
/*----------------------*/


$tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);

if($tsAdmin->getElement('success', $tsAdmin->connect())) {
   $tsAdmin->login($ts3_user, $ts3_pass);
   $tsAdmin->selectServer($ts3_port);
    $tsAdmin->setName($ts3_name);

 
}else{
   die('Connection could not be established.');
}
?>
<!DOCTYPE html>
<html>
<head>
   <style>
    * {
   margin: 0;
   padding: 0;
   cursor: default;
    }

    ::selection {
        text-shadow: 0 1px 0 rgba(0, 0, 0, 0.75) !important;
        color: #fff;
        background-color: transparent;
    }

    *:focus {outline:0;}

    body {
        background-color: #dde0e3;
        font-size: 12px;
        font-family: Tahoma,Helvetica,Arial,sans-serif;
        color: rgb(71,75,81);
        word-wrap: break-word;
        line-height: 1.28;
    }

    .content {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        -webkit-transform: translateX(-50%);
        padding-right: 5px;
        padding-left: 5px;
        margin: 0;
        max-width: 800px;
        box-sizing: border-box;
        text-align: center;
    }

    .box {
        background: rgb(250,250,251) repeat-x top;
        padding: 10px;
        border: 1px solid rgb(206,210,216);
        margin: 3px;
        box-shadow: rgba(0,0,0,0.05) 0px 1px 3px;
        border-radius: 4px;
        width: 200px;
        float: left;
    }

    .box-title {
        font-weight: bold;
        color: rgb(60,65,75);
        background-color: rgb(235,236,239);
        padding: 10px;
        margin: -10px -10px 10px;
        border-bottom: 1px solid rgb(206,210,216);
        border-top-left-radius: 3px;
        border-top-right-radius: 3px;
        background-image: -moz-linear-gradient(top,rgba(255,255,255,0.35) 0%,rgba(255,255,255,0) 100%);
        background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0%,rgba(255,255,255,.35)),color-stop(100%,rgba(255,255,255,0)));
        background-image: -webkit-linear-gradient(top,rgba(255,255,255,.35) 0%,rgba(255,255,255,0) 100%);
        background-image: -o-linear-gradient(top,rgba(255,255,255,.35) 0%,rgba(255,255,255,0) 100%);
        background-image: -ms-linear-gradient(top,rgba(255,255,255,.35) 0%,rgba(255,255,255,0) 100%);
        background-image: linear-gradient(to bottom,rgba(255,255,255,.35) 0%,rgba(255,255,255,0) 100%);
        box-shadow: inset rgba(255,255,255,0.7) 0px 1px 0px;
        text-shadow: rgba(255,255,255,0.9) 0px 1px 0px;
        text-align: center;
    }

    .circle {
        border-radius: 50%;
        width: 45px;
        height: 45px;
        padding: 10px;
        border: 1px solid rgb(206,210,216);
        color: rgb(60,65,75);
        text-align: center;
        font: 33px Tahoma, sans-serif;
        box-shadow: inset rgba(255,255,255,0.7) 0px 1px 0px;
        text-shadow: rgba(255,255,255,0.9) 0px 1px 0px;
        background-image: linear-gradient(to bottom,rgba(255,255,255,.35) 0%,rgba(255,255,255,0) 100%);
        margin-left: auto;
        margin-right: auto;
    }
    </style>
</head>
<body>
    <div class="content">
        <?php
        foreach($cfg['groups'] as $groupID){
            echo '<div class="box">';
            foreach($tsAdmin->serverGroupList()['data'] as $serverGroup){
                if($serverGroup['sgid'] == $groupID){
                    echo '<div class="box-title">'.$serverGroup['name'].'</div>';
                }
            }
        echo '<div class="circle">'.count($tsAdmin->serverGroupClientList($groupID, $names = false)['data'])."</div></div>";
        } ?></div>
    </div>
</body>
</html>
nice work but
can you change it to show how many client is online on this servergroup?
 

Norvik

Retired Staff
Contributor
Jul 18, 2015
635
588
157
nice work but
can you change it to show how many client is online on this servergroup?
Sure do you want me to show both or just the online users. I could show the online users in a green circle and the offline or total users in a red circle.
 
Top