Guest User

Untitled

a guest
Jan 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.35 KB | None | 0 0
  1. <?PHP
  2.  
  3. $ts3_ip = '127.0.0.1';
  4. $ts3_queryport = 10011;
  5. $ts3_user = 'serveradmin';
  6. $ts3_pass = 'IEMSUtgV';
  7. $ts3_port = 9987;
  8.  
  9. #Include ts3admin.class.php
  10. require("ts3admin.class.php");
  11.  
  12. #build a new ts3admin object
  13. $tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);
  14.  
  15. if($tsAdmin->getElement('success', $tsAdmin->connect())) {
  16.     #login as serveradmin
  17.     $tsAdmin->login($ts3_user, $ts3_pass);
  18.    
  19.     #select teamspeakserver
  20.     $tsAdmin->selectServer($ts3_port);
  21.    
  22.     #check if id parameter is set
  23.     if(isset($_GET['id']) and !empty($_GET['id']) and ctype_digit($_GET['id'])) {
  24.         #kick player from server
  25.         if(!$tsAdmin->clientKick($_GET['id'], 'server')) {
  26.             #show error if client kick was failed
  27.             echo '<script>alert(\'Client not found\')</script>';
  28.         }
  29.     }
  30.    
  31.     #get clientlist
  32.     $clients = $tsAdmin->clientList();
  33.    
  34.     #print client count
  35.     echo count($clients['data']) . ' clients on selected server<br><br>';
  36.    
  37.     #print clients to browser
  38.     foreach($clients['data'] as $client) {
  39.         echo '<a href="clientkick.php?id='.$client['clid'].'">'.$client['client_nickname'].'</a><br>';
  40.     }
  41. }else{
  42.     echo 'Connection could not be established.';
  43. }
  44.  
  45. /**
  46.  * This code retuns all errors from the debugLog
  47.  */
  48. if(count($tsAdmin->getDebugLog()) > 0) {
  49.     foreach($tsAdmin->getDebugLog() as $logEntry) {
  50.         echo '<script>alert(\''.$logEntry.'\');</script>';
  51.     }
  52. }
  53. ?>
Add Comment
Please, Sign In to add comment