Channel Web master

pipeter21

Active Member
Jul 5, 2017
15
3
93
Hi, I need help to create sub channels, this script only creates one channel and one sub channel. but I need to create a sub-channel more. please help

Code:
<?php
require_once ("TeamSpeak3.php");
include ('config.php');
error_reporting(0);

$ChannelName = $_POST['name'];
$SubChannelName = $_POST['subname'];
$ChannelPassword = $_POST['ChannelPass'];
$SubChannelPass = $_POST['SubChannelPass'];
$idUnica = $_POST['idts'];

if (!$ChannelName || !$idUnica) {
    echo "Ingrese ambos detalles del Nombre del canal y el UniqID";
    exit();
}

$ts3_VirtualServer = TeamSpeak3::factory("serverquery://" . $UserAdmin . ":" . $PWQuery . "@" . $IP_TS . ":" . $PuertoQuery . "/?server_port=" .  $PuertoTS . "&blocking=0&nickname=" . $nickname . "");
$ListaDeChannels = $ts3_VirtualServer->request("channellist")->toString();

if (strpos($ListaDeChannels, $ChannelName)) {
    echo "Lo Sentimos Este canal ya existe!";
    exit();
}
$clID = $ts3_VirtualServer->clientGetByUid($idUnica);
$sub_cid = $ts3_VirtualServer->channelCreate(array(
    "channel_name" => $ChannelName,
    "channel_password" => $ChannelPassword,
    "channel_codec" => TeamSpeak3::CODEC_OPUS_VOICE,
    "channel_topic" => "Canal creado por hardgamerz",
    "channel_flag_permanent" => TRUE,
    "cpid"                   => '531',
));
$sub2_cid = $ts3_VirtualServer->channelCreate(array(
    "channel_name" => $SubChannelName,
    "channel_password" => $ChannelPassword,
    "channel_codec" => TeamSpeak3::CODEC_OPUS_VOICE,
    "channel_topic" => "Canal creado por hardgamerz",
    "channel_flag_permanent" => TRUE,
    "cpid"                   => $sub_cid,
));
$clID = $ts3_VirtualServer->clientGetByUid($idUnica);
$infoCliente = $ts3_VirtualServer->execute("clientgetnamefromuid", array(
    "cluid" => $idUnica
))->toList();
$cldbid = strval($infoCliente['cldbid']);
$ts3_VirtualServer->execute("clientmove", array(
    "clid" => $clID,
    "cid" => $sub_cid
));
$ts3_VirtualServer->execute("setclientchannelgroup", array(
    "cldbid" => $cldbid,
    "cid" => $sub_cid,
    "cgid" => '9'
));
echo "¡Felicidades, tu canal ha sido creado! ¡Sigue siendo agradable!";
?>
 
Top