Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once ("TeamSpeak3.php");
- include ('config.php');
- error_reporting(0);
- $ChannelName = $_POST['name'];
- $idUnica = $_POST['idts'];
- $password = $_POST['pass'];
- if (!$ChannelName || !$idUnica) {
- echo "El nombre del channel y la ID unica tienen que estar";
- exit();
- }
- if($request->quality < 1 || $request->quality > 10)
- {
- $request->quality = 7;
- }
- $ts3_VirtualServer = TeamSpeak3::factory("serverquery://" . $UserAdmin . ":" . $PWQuery . "@" . $IP_TS . ":" . $PuertoQuery . "/?server_port=" . $PuertoTS . "");
- $ListaDeChannels = $ts3_VirtualServer->request("channellist")->toString();
- if (strpos($ListaDeChannels, $ChannelName)) {
- echo "El nombre del channel esta en uso, utiliza otro";
- exit();
- }
- $clID = $ts3_VirtualServer->clientGetByUid($idUnica);
- $top_cid = $ts3_VirtualServer->channelCreate(array(
- "channel_name" => $ChannelName,
- "channel_password" => $password,
- "channel_codec" => TeamSpeak3::CODEC_OPUS_VOICE,
- "channel_quality" => TeamSpeak3::CODEC_OPUS_VOICE,
- "channel_codec_quality" => $request->quality,
- "channel_flag_temporary" => TRUE,
- ));
- $clID = $ts3_VirtualServer->clientGetByUid($idUnica);
- $infoCliente = $ts3_VirtualServer->execute("clientgetnamefromuid", array(
- "cluid" => $idUnica
- ))->toList();
- $conn = new mysqli($servername, $username, $password, $dbname);
- $sql = "INSERT INTO prueba (ChannelName, channel password, idts)
- VALUES ('$ChannelName', '$password', '$idUnica')";
- $conn->close();
- $cldbid = strval($infoCliente['cldbid']);
- $ts3_VirtualServer->execute("clientmove", array(
- "clid" => $clID,
- "cid" => $top_cid
- ));
- $ts3_VirtualServer->execute("setclientchannelgroup", array(
- "cldbid" => $cldbid,
- "cid" => $top_cid,
- "cgid" => '13'
- ));
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement