Guest User

Untitled

a guest
May 22nd, 2016
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.50 KB | None | 0 0
  1. <?php
  2. /*-------SETTINGS-------*/ //PLEASE EDIT THIS PART
  3. $ts3_ip = '127.0.0.1';
  4. $ts3_queryport = 10011;
  5. $ts3_user = 'serveradmin';
  6. $ts3_pass = 'NASRAT';
  7. $ts3_port = 9987;
  8. /*----------------------*/
  9.  
  10. #Include ts3admin.class.php
  11. require("ts3admin.class.php");
  12.  
  13. #build a new ts3admin object
  14. $tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);
  15.  
  16. function array2table($array) {
  17.     $html = '';
  18.  
  19.  
  20.         $html .= '<table cellpadding="5" cellspacing="1" bgcolor="black" align="center" width="';
  21.  
  22.  
  23.             $html .= '400px">';
  24.             $html .= '<tr>';
  25.             $html .= '<td bgcolor="#c0c0c0" style="font-weight:bold" align="center">Key</td>';
  26.             $html .= '<td bgcolor="#c0c0c0" style="font-weight:bold" align="center">Value</td>';
  27.             $html .= '</tr>';
  28.  
  29.             foreach($array as $key => $value) {
  30.                 $html .= '<tr>';
  31.                 $html .= '<td bgcolor="red" align="center">'.htmlspecialchars($key).'</td>';
  32.                 $html .= '<td bgcolor="#ffffff" align="center">'.htmlspecialchars($value).'</td>';
  33.                 $html .= '</tr>';
  34.             }
  35.  
  36.    
  37.     return $html;
  38. }
  39. $html = '';
  40.  
  41. if($tsAdmin->getElement('success', $tsAdmin->connect()))
  42. {
  43.     #login as serveradmin
  44.     $tsAdmin->login($ts3_user, $ts3_pass);
  45.     #select teamspeakserver
  46.     $tsAdmin->selectServer($ts3_port);
  47.     $customFieldSet = array();
  48.     $output = $tsAdmin->tokenAdd('0','7','0','registrationtoken',$customFieldSet);
  49.     $html = array2table($output['data']);
  50.  
  51. }
  52. else
  53. {
  54.     echo 'Connection could not be established.';
  55. }
  56.  
  57. ?>
  58. <html>
  59.     <head>
  60.    
  61.     </head>
  62.     <body>
  63.         <?php echo $html; ?>
  64.     </body>
  65. </html>
Add Comment
Please, Sign In to add comment