I need (plz help)
Viewing member of a particular group
ID grup : 12
I want to create a table
for instance
Nick ONLINE
Nick1 ONLINE
Nick2 ONLINE
Nick3 ONLINE
I need (plz help)
Viewing member of a particular group
ID grup : 12
I want to create a table
for instance
Nick ONLINE
Nick1 ONLINE
Nick2 ONLINE
Nick3 ONLINE
Hello,
I think you wanna use HTML and PHP, right? Therefore you have to use the ts3admin.class (ts3admin.class) and the following PHP-script:
<?php
require("ts3admin.class.php");
/* Settings */
$host = "localhost";
$serverQueryPort = 10011;
$username = "serveradmin";
$password = "serverQueryPassword";
$virtualServerVoicePort = 9987;
$ts3admin = new ts3admin($host, $serverQueryPort);
/* Connect to TeamSpeak instance */
if($ts3admin->getElement('success', $ts3admin->connect())) {
/* Login */
$ts3admin->login($username, $password);
/* Select virtual server */
$ts3admin->selectServer($virtualServerVoicePort);
/* Get clientlist of set group id (= sgid) */
$serverGroupClientList = $ts3admin->serverGroupClientList(12, true);
if($serverGroupClientList['success']) {
$serverGroupClientList = $serverGroupClientList['data'];
/* Get clientlist of current online users */
$clientList = $ts3admin->clientList();
if($clientList['success']) {
$clientList = $clientList['data'];
$ClientDatabaseIDList = array();
foreach($clientList as $row => $value) {
$ClientDatabaseIDList[] = $value['client_database_id'];
}
/* Create HTML table */
echo "<table border='1'>";
echo "<tr>";
echo "<th>Nickname</th>";
echo "<th>State</th>";
echo "</tr>";
foreach($serverGroupClientList as $row => $value) {
echo "<tr>";
echo "<td>" . $value['client_nickname'] . "</td>";
echo "<td>";
/* Contains the clientList of current online users the client database id of someone of the servergroup? If yes, write 'Online' in green */
if(in_array($value['cldbid'], $ClientDatabaseIDList)) {
echo "<font color='green'>Online</font>";
} else {
echo "<font color='red'>Offline</font>";
}
echo "</td>";
echo "</tr>";
}
echo "</table>";
}
} else {
echo "Could not fetch client list.";
}
} else {
echo "Connection could not be established.";
}
?>
Alles anzeigen
This script returns following output for example:
you are my GOD ! Everything works nicely
Perfect! Thanks for your feedback!
I have a small question .
Sometimes I get this message on your website
"Fatal error: Cannot redeclare class ts3admin in/home/j*********/public_html/ts3admin.class.php on line 45"
Can somehow fix it?