Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once "ts3admin.class.php";
- /*-------SETTINGS-------*/
- $ts3_ip = '127.0.0.1';
- $ts3_queryport = 10011;
- $ts3_port = 9987;
- $ts3_username = "serveradmin";
- $ts3_password = "password";
- $ts3_group_id = 2;
- /*----------------------*/
- echo '<table border="1"><tr><td>Username</td><td>Kanal</td><td>Status</td></tr>';
- $tsAdmin = new ts3admin("127.0.0.1", "10011");
- if($tsAdmin->getElement('success', $tsAdmin->connect()))
- {
- #login as serveradmin
- $login = $tsAdmin->login($ts3_username, $ts3_password);
- if($login["success"])
- {
- #select teamspeakserver
- $tsAdmin->selectServer($ts3_port);
- #get serverGroupClientList
- $groupList = $tsAdmin->serverGroupClientList($ts3_group_id, true);
- #get ClientList
- $userList = $tsAdmin->clientList("-uid -times");
- if($groupList["success"] && $userList["success"])
- {
- foreach($groupList["data"] as $srow => $svalue)
- {
- #check FOR EACH Group if the Member of the Group is online
- $nick = $svalue["client_nickname"];
- $isonline = 0;
- foreach($userList["data"] as $usrow => $usvalue)
- {
- #Check FOR EACH User who is online, if he is in the Group
- $cldbid = $usvalue['client_database_id'];
- #check wether a User is in the Group
- if($svalue["cldbid"] == $cldbid)
- {
- $isonline = 1;
- $cid = $usvalue['cid'];
- break;
- }
- }
- #Is the User Online?
- if($isonline)
- {
- $status = '<span style="color:green;">Online</span><br /><br />';
- $channel = ($tsAdmin->channelInfo($cid)['data']['channel_name']);
- }
- else
- {
- $status = '<span style="color:red;">Offline</span><br /><br />';
- $channel = "Unavailable";
- }
- #Print Entry to table
- echo "
- <tr>
- <td><p>". $nick ."<br /></td><td><small>Channel: ".$channel."<br /></small></td>
- <td>". $status ."</td>
- </tr>";
- }
- }
- else
- {
- echo "Can't get Grouplist AND/OR UserList: ".$groupList["errors"][0]." / ".$userList["errors"][0];
- }
- }
- else
- {
- echo "Can't Login: ".$login["errors"][0];
- }
- }
- else
- {
- echo 'Connection could not be established.';
- }
- echo "</table>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement