Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- $ts3_ip = '127.0.0.1';
- $ts3_queryport = 10011;
- $ts3_user = 'serveradmin';
- $ts3_pass = 'IEMSUtgV';
- $ts3_port = 9987;
- #Include ts3admin.class.php
- require("ts3admin.class.php");
- #build a new ts3admin object
- $tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);
- if($tsAdmin->getElement('success', $tsAdmin->connect())) {
- #login as serveradmin
- $tsAdmin->login($ts3_user, $ts3_pass);
- #select teamspeakserver
- $tsAdmin->selectServer($ts3_port);
- #check if id parameter is set
- if(isset($_GET['id']) and !empty($_GET['id']) and ctype_digit($_GET['id'])) {
- #kick player from server
- if(!$tsAdmin->clientKick($_GET['id'], 'server')) {
- #show error if client kick was failed
- echo '<script>alert(\'Client not found\')</script>';
- }
- }
- #get clientlist
- $clients = $tsAdmin->clientList();
- #print client count
- echo count($clients['data']) . ' clients on selected server<br><br>';
- #print clients to browser
- foreach($clients['data'] as $client) {
- echo '<a href="clientkick.php?id='.$client['clid'].'">'.$client['client_nickname'].'</a><br>';
- }
- }else{
- echo 'Connection could not be established.';
- }
- /**
- * This code retuns all errors from the debugLog
- */
- if(count($tsAdmin->getDebugLog()) > 0) {
- foreach($tsAdmin->getDebugLog() as $logEntry) {
- echo '<script>alert(\''.$logEntry.'\');</script>';
- }
- }
- ?>
Add Comment
Please, Sign In to add comment