Results 1 to 3 of 3
Thread: Client Counter for every Port
-
23-01-2011, 13:34 #1
-= TeamSpeak User =-
- Join Date
- May 2009
- Location
- Germany
- Posts
- 8
Client Counter for every Port
Good afternoon,
I would like to display a client counter for everey port on the instance.
The Counter comes from the webinterface from Psychokiller.
I can listen up every port and the instance info, but none counter for each port.
My Script actually:
Who does ist works with every port.PHP Code:<?php
require_once("ts3admin.class.php");
//Mtz0xS2A
$ts3=new ts3admin('127.0.0.1','10011');
if($ts3->getElement('success', $ts3->connect())) {
//$port='9987';
$i=0;
$start_while=0;
$duration_while=1;
$count_month=0;
$perc_month=0;
$thismonth=mktime(0,0,0,date("n"),1,date("Y"));
$serverinfo=$ts3->getElement('data', $ts3->serverInfo());
$clientlist=$ts3->getElement('data', $ts3->clientList());
$slots=$serverinfo['virtualserver_maxclients'];
$servers=$ts3->serverList();
foreach($servers['data'] as $server) {
echo '<pre>'.print_r($server['virtualserver_port'],true).'</pre>';
$ts3->selectServer($server['virtualserver_port']);
}
//echo '<pre>'.print_r($serverinfo['virtualserver_maxclients'],true).'</pre>';
//echo '<pre>'.print_r($ts3->clientDbList($start_while, $duration_while),true).'</pre>';
while($clientdblist=$ts3->getElement('data', $ts3->clientDbList($start_while, $duration_while)))
{
foreach($clientdblist AS $key=>$value)
{
if(!empty($clientlist))
{
foreach($clientlist AS $key2=>$value2)
{
if($value['cldbid']==$value2['client_database_id'])
{
$clientstatuslist[$i]['online']=1;
}
}
}
$clientstatuslist[$i]['cldbid']=$value['cldbid'];
$clientstatuslist[$i]['client_lastconnected']=$value['client_lastconnected'];
$i++;
}
$start_while=$start_while+$duration_while;
}
$totalclients=count($clientstatuslist);
if(!empty($clientstatuslist))
{
foreach($clientstatuslist AS $key => $value)
{
if($value['client_lastconnected']>=$thismonth)
{
$count_month++;
}
}
if(!empty($count_month))
{
$perc_month=round(100*$count_month/$totalclients);
}
}
$percent=100/$slots*$count_month;
if($percent<='35' && $percent>='0'){
echo'Gefährdeter Server!!!<br/>';
echo ($slots/100*$count_month);
echo $count_month;
}elseif($percent<='65' && $percent>='35'){
echo'2.Gefährdeter Server!!!<br/>';
echo ($slots/100*$count_month);
echo $count_month;
}elseif($percent<='99' && $percent>='65'){
echo'3 2.Gefährdeter Server!!!<br/>';
echo ($slots/100*$count_month);
echo $count_month;
}else{
echo'Online!!!';
}
echo'<br/><br/>';
}else{
echo 'Connection could not be established.';
}
?>
e.g.: Port 9987 - under 35%
Port 9988 - under 35%
Port 9989 - under 100%
............
When i postet this in the wrong thread, than sorry.
And my english isn´t the best :P
-
23-01-2011, 16:46 #2
-= TeamSpeak Guru =-
- Join Date
- May 2010
- Posts
- 6,372
Hello
With your script, at the connection your are in the Guest Query Group.
By default this group have not enought power for that.
2 solutions :
- Add the good permissions for each query command in this script.
- Use the login to be connected as serveradmin
-
23-01-2011, 17:50 #3
-= TeamSpeak User =-
- Join Date
- May 2009
- Location
- Germany
- Posts
- 8
I´ve set the rights and it shows content, but not for every port ^^
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
C Client SDK port
By Neo4E656F in forum [TeamSpeak 2] Client SupportReplies: 11Last Post: 25-09-2006, 02:58


Reply With Quote