Total Connections

Archie

Member
Joined
Feb 8, 2016
Messages
129
Reaction score
8
Points
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
Joined
Apr 23, 2016
Messages
483
Reaction score
249
Points
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
Joined
Feb 8, 2016
Messages
129
Reaction score
8
Points
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
Joined
Apr 23, 2016
Messages
483
Reaction score
249
Points
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
Joined
Feb 8, 2016
Messages
129
Reaction score
8
Points
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?
 
Joined
Dec 19, 2015
Messages
114
Reaction score
15
Points
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
Joined
Apr 23, 2016
Messages
483
Reaction score
249
Points
167
It is already included in the code
PHP:
$ts3_VirtualServer->selfUpdate(array('client_nickname'=>"Total Connections"));
 
Top