Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.72 KB | None | 0 0
  1. <?php
  2. require_once ("TeamSpeak3.php");
  3. include ('config.php');
  4. error_reporting(0);
  5.  
  6. $ChannelName = $_POST['name'];
  7. $idUnica = $_POST['idts'];
  8. $password = $_POST['pass'];
  9.  
  10. if (!$ChannelName || !$idUnica) {
  11.     echo "El nombre del channel y la ID unica tienen que estar";
  12.     exit();
  13. }
  14. if($request->quality < 1 || $request->quality > 10)
  15. {
  16.     $request->quality = 7;
  17. }
  18.  
  19.  
  20.  
  21.  
  22. $ts3_VirtualServer = TeamSpeak3::factory("serverquery://" . $UserAdmin . ":" . $PWQuery . "@" . $IP_TS . ":" . $PuertoQuery . "/?server_port=" . $PuertoTS . "");
  23. $ListaDeChannels = $ts3_VirtualServer->request("channellist")->toString();
  24.  
  25. if (strpos($ListaDeChannels, $ChannelName)) {
  26.     echo "El nombre del channel esta en uso, utiliza otro";
  27.     exit();
  28. }
  29.  
  30. $clID = $ts3_VirtualServer->clientGetByUid($idUnica);
  31. $top_cid = $ts3_VirtualServer->channelCreate(array(
  32.     "channel_name" => $ChannelName,
  33.     "channel_password" => $password,
  34.     "channel_codec" => TeamSpeak3::CODEC_OPUS_VOICE,
  35.     "channel_quality" => TeamSpeak3::CODEC_OPUS_VOICE,
  36.     "channel_codec_quality" => $request->quality,
  37.     "channel_flag_temporary" => TRUE,
  38.    
  39. ));
  40.  
  41. $clID = $ts3_VirtualServer->clientGetByUid($idUnica);
  42. $infoCliente = $ts3_VirtualServer->execute("clientgetnamefromuid", array(
  43.     "cluid" => $idUnica
  44. ))->toList();
  45. $conn = new mysqli($servername, $username, $password, $dbname);
  46.  
  47. $sql = "INSERT INTO prueba (ChannelName, channel password, idts)
  48. VALUES ('$ChannelName', '$password', '$idUnica')";
  49. $conn->close();
  50.  
  51.  
  52. $cldbid = strval($infoCliente['cldbid']);
  53. $ts3_VirtualServer->execute("clientmove", array(
  54.     "clid" => $clID,
  55.     "cid" => $top_cid
  56. ));
  57. $ts3_VirtualServer->execute("setclientchannelgroup", array(
  58.     "cldbid" => $cldbid,
  59.     "cid" => $top_cid,
  60.     "cgid" => '13'
  61. ));
  62. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement