Advertisement
Guest User

Untitled

a guest
Oct 17th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. // how i take client id form nickname and channel id from array
  2.  
  3. <?php
  4. require_once('lib/ts3admin.class.php');
  5.  
  6. $tsIp = '127.0.0.1';
  7. $tsQueryPort = '10011';
  8. $tsUsername = 'serveradmin';
  9. $tsPass = 'qtR1I4hl';
  10. $tsPort = '9987';
  11. $tsQueryName = 'sexy';
  12.  
  13. $tsAdmin = new ts3admin ($tsIp, $tsQueryPort);
  14. if ($tsAdmin->getElement('success', $tsAdmin->connect())) {
  15. $tsAdmin->login($tsUsername,$tsPass);
  16. $tsAdmin->selectServer($tsPort);
  17. $tsAdmin->setName("$tsQueryName");
  18. $whoAmI = $tsAdmin->whoAmI();
  19.  
  20. echo "Connection established server!\n";
  21. print_r($tsAdmin->clientInfo(1));
  22.  
  23. while (true) {
  24. $clientList = $tsAdmin->clientList();
  25. foreach ($clientList['data'] as $clientListTemp) {
  26. $nickname = $clientListTemp['client_nickname'];
  27. if ($nickname == '<3') {
  28. $UserMoveToChannelCreate = $clientListTemp['clid'];
  29. $id = count($tsAdmin->channelList()['data']);
  30. $channelCreate = array (
  31. 'channel_name' => "$id. Nomecanale",
  32. 'channel_flag_permanent' => 1,
  33. 'cpid' => '276844'
  34. );
  35. $result = $tsAdmin->channelCreate($channelCreate);
  36.  
  37. $tsAdmin->clientMove({PUT CLIENT ID HERE}, $result['data']['cpid']);
  38. }
  39. }
  40. sleep(5);
  41. }
  42.  
  43. } else {
  44. echo 'Connection could not be established.\n';
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement