Total Connections

Archie

Member
Feb 8, 2016
129
8
53
Hello,

Does anyone have a PHP script which will get the total number of connections (http://prntscr.com/by9lcz) to our server?
I'm kinda new to PHP but I know my way around it a little.

Any help would be helpful
Thanks!
 

Najsr

Moderator
TeamSpeak Developer
Apr 23, 2016
483
249
167
PHP:
<?php
require_once("libraries/TeamSpeak3/TeamSpeak3.php");
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://username:[email protected]:10011/?server_port=9987");
$ts3_VirtualServer->selfUpdate(array('client_nickname'=>"Total Connections"));
foreach($ts3_VirtualServer->clientList() as $client)
{
    if($client["client_type"]) continue;
    echo $client['client_nickname'] . " conneted " . $client['client_totalconnections'] . " times.<br/>";
}
?>
This will print total connections for every client that is connected
 

Archie

Member
Feb 8, 2016
129
8
53
PHP:
<?php
require_once("libraries/TeamSpeak3/TeamSpeak3.php");
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://username:[email protected]:10011/?server_port=9987");
$ts3_VirtualServer->selfUpdate(array('client_nickname'=>"Total Connections"));
foreach($ts3_VirtualServer->clientList() as $client)
{
    if($client["client_type"]) continue;
    echo $client['client_nickname'] . " conneted " . $client['client_totalconnections'] . " times.<br/>";
}
?>
This will print total connections for every client that is connected
Thanks but this displays the clients, all I want is the total server connections not by each client. So it would display total connections 1135. Thanks
 

Najsr

Moderator
TeamSpeak Developer
Apr 23, 2016
483
249
167
PHP:
<?php
require_once("libraries/TeamSpeak3/TeamSpeak3.php");
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://username:password@localhost:10011/?server_port=9987");
$ts3_VirtualServer->selfUpdate(array('client_nickname'=>"Total Connections"));
$totalconnections = '';
foreach($ts3_VirtualServer->clientListDb(0,1000000) as $client)
{
    $totalconnections = $totalconnections + $client['client_totalconnections'];
}
echo "Total conections: ".$totalconnections;
?>
Here :)
 

Archie

Member
Feb 8, 2016
129
8
53
PHP:
<?php
require_once("libraries/TeamSpeak3/TeamSpeak3.php");
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://username:password@localhost:10011/?server_port=9987");
$ts3_VirtualServer->selfUpdate(array('client_nickname'=>"Total Connections"));
$totalconnections = '';
foreach($ts3_VirtualServer->clientListDb(0,1000000) as $client)
{
    $totalconnections = $totalconnections + $client['client_totalconnections'];
}
echo "Total conections: ".$totalconnections;
?>
Here :)
How would I change this for query client connections?
 
Dec 19, 2015
114
15
53
How would I change this for query client connections?
Do You Mean The Name Of The Bot
if So
Here You Go
PHP:
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://username:password@localhost:10011/?server_port=9987&nickname=BOTNAMEHERE");
 

Najsr

Moderator
TeamSpeak Developer
Apr 23, 2016
483
249
167
It is already included in the code
PHP:
$ts3_VirtualServer->selfUpdate(array('client_nickname'=>"Total Connections"));
 
Top