[Script] Create Channel with Web

thespeedy

Member
Jan 16, 2016
24
1
35
PHP:
<?php
session_start();
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 "Introduceti ambele detalii Numele Canalului dar și UniqId-ul";
   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 "Acest canal există deja!";
   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 creat via EvDBoard",
   "channel_flag_permanent" => TRUE,
   "cpid"  => '57',
));
$sub2_cid = $ts3_VirtualServer->channelCreate(array(
   "channel_name" => $SubChannelName,
   "channel_password" => $ChannelPassword,
   "channel_codec" => TeamSpeak3::CODEC_OPUS_VOICE,
   "channel_topic" => "Canal creat via EvDBoard",
   "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 "Felicitări canalul tău a fost creat ! Ședere plăcută în continuare !";
?>[php]
 

Mr-Malone

You risk and you will win
Sep 11, 2015
69
25
108
Hi all . Since May I speak to the two project partners for this script. We make various improvements to this hugely script so that everyone liked. Expect some opinions or suggestions for what we could include in the script, what options? The PM or reply.
 

panteL

Restricted
Mar 17, 2016
146
44
63
Hi all . Since May I speak to the two project partners for this script. We make various improvements to this hugely script so that everyone liked. Expect some opinions or suggestions for what we could include in the script, what options? The PM or reply.
I wish you all the best :)
 

strux1

Member
Mar 19, 2016
30
1
43
It's working but how can i set a spam protection to it?
And is it able to delete the channel after 1 day and not 7 days?
 

decon20

Member
Mar 27, 2016
32
5
43
Hi, I have set this to permanent channel, but, how i set to create on permanent zone?
 

hackerpedro

Member
May 7, 2016
34
1
43
Last form create channel above spacer, but firts in channel tree.

ex:

Spacer.

here is your channel.
1.Channel Client
2.Channel Client

Now i give you 2 options more.

1. For create channel in specify spacer (but above all channels).
2. For Create channel in more than 1 spacer (but above all channels).


1.

A. Create 1 .txt with spacer ID

ex.

channel_order.txt
firts line (1 line)
2354

B. Edit Crear.php

Put this above line 5 (error_reporting(0))

PHP:
//////////////////////////////
$order_txt = "channel_order.txt";    //String file path
$size_txt = filesize($order_txt);  // File size (how much data to read)
$heandle_txt = fopen($order_txt,"r");   // File handle
$conteude_txt = fread($heandle_txt,$tamanho_txt);  // Read data from file handle
echo $conteude_txt;
fclose($heandle_txt);  // Close handle
//////////////////////////////

Now edit:

PHP:
$sub_cid = $ts3_VirtualServer->channelCreate(array(
    "channel_name" => $ChannelName,
    "channel_password" => $ChannelPassword,
    "channel_codec" => TeamSpeak3::CODEC_OPUS_VOICE,
    "channel_topic" => "Canal creat via EvDBoard",
    "channel_flag_permanent" => TRUE,
    "cpid"                   => '57',
));

Add "channel_order" => $order_txt

PHP:
$sub_cid = $ts3_VirtualServer->channelCreate(array(
    "channel_name" => $ChannelName,
    "channel_password" => $ChannelPassword,
    "channel_codec" => TeamSpeak3::CODEC_OPUS_VOICE,
    "channel_topic" => "Canal creat via EvDBoard",
    "channel_flag_permanent" => TRUE,
    "cpid"                   => '57',
    "channel_order" => $order_txt,
));

Now you did was take the value found in the txt file and displayed here in the variable.

You need Write in txt last channel id channel, in this case the channel id its "$sub_cid"

Before "$cldbid = strval($infoCliente['cldbid']);" in crear.php you need put this..

PHP:
//////////////////////////////
$order_txt = fopen("channel_order.txt", "w") or die("file channel_order.txt not exist");
fwrite($order_txt, $sub_cid);
fclose($order_txt);
//////////////////////////////

Finish. Now you create channel and the channel_order.txt (have there last channel id)

Test it!

Ok, so i have a doubt...

Example TS3 layout:
SPACER
Admin_Channel1
Admin_Channel2
Admin_Channel3
SPACER
Public_Channel1
Public_Channel2
Public_Channel3
SPACER
Private_Channel1
Private_Channel2
Private_Channel3
SPACER
Temporary_Channel1
Temporary_Channel2
Temporary_Channel3
So here in this layout I want the form to add new channels bellow the "Private_Chennels" like: "Private_Channel3, Private_Channel4, Private_Channel5... and so on" what do I have to change in the files so that the php knows where to put new channels?

And one more question.
I want the main channel to be limited to 0 users, like this:
Main_Channel (inaccessible, just to show the name)
Sub_Channel1
Sub_Channel2
...
Last one i promise :)
I want the users to have the ability to chose to have more than 1 sub-channel on the form, like:
(text-field) Main Channel Name:
(text-field) Main Channel Password:
(text-field) Sub-channel 1 Name:
(text-field) Sub-channel 1 Password:
(text-field) Sub-channel 2 Name: (ONLY IF "ADD ADD 1 MORE SUB-CHANNEL" BUTTON IS PRESSED THE FIRST TIME)
(text-field) Sub-channel 2 Password: (ONLY IF "ADD ADD 1 MORE SUB-CHANNEL" BUTTON IS PRESSED THE FIRST TIME)
(text-field) Sub-channel 3 Name: (ONLY IF "ADD ADD 1 MORE SUB-CHANNEL" BUTTON IS PRESSED THE SECOND TIME)
(text-field) Sub-channel 3 Password: (ONLY IF "ADD ADD 1 MORE SUB-CHANNEL" BUTTON IS PRESSED THE FIRST TIME)
(text-field) Sub-channel 4 Name: (ONLY IF "ADD ADD 1 MORE SUB-CHANNEL" BUTTON IS PRESSED THE THIRD TIME)
(text-field) Sub-channel 4 Password: (ONLY IF "ADD ADD 1 MORE SUB-CHANNEL" BUTTON IS PRESSED THE FIRST TIME)
(text-field) Sub-channel 5 Name: (ONLY IF "ADD ADD 1 MORE SUB-CHANNEL" BUTTON IS PRESSED THE FORTH TIME)
(text-field) Sub-channel 5 Password: (ONLY IF "ADD ADD 1 MORE SUB-CHANNEL" BUTTON IS PRESSED THE FIRST TIME)
(button) ADD 1 MORE SUB-CHANNEL (if pressed a field appears (max. 4 times, after the 4 time pressed the buttons disappears))
(button) GET MY CHANNELS
Is it possible to review my case? I really need help, thanks for your time!
 
Last edited by a moderator:

hackerpedro

Member
May 7, 2016
34
1
43
And if you have the time I will love to get a extended feature set, and if you do I would love you to help me, the urgent is what I posted first, this is only if you have time!

- Auto delete channels in 30 days if there is no activity;
- Register e-mail when create channels so that user can recover channel password if lost!
- Only one set of 5 channels per "client IP" and "UniqueID" (so when the client connects to the panel if he has any channel created a management pannel appears *);
- * When the client access the CREATE CHANNEL URL again, if the "client IP" or "unique ID" already has a channel, a panel is presented to manage the channels, like this:
Your Nickname ([ONLY READ])

Main Channel ([OPTION] CHANGE NAME and DETELE ALL MY CHANNELS)
Sub-Channel NAME 1 ([OPTION] CHANGE NAME and CAN NOT BE DELETED)
Sub-Channel NAME 2 ([OPTION] ADD (if does not exists) or CHANGE NAME (if exists) or DELETE (if exists))
Sub-Channel NAME 3 ([OPTION] ADD (if does not exists) or CHANGE NAME (if exists) or DELETE (if exists))
Sub-Channel NAME 4 ([OPTION] ADD (if does not exists) or CHANGE NAME (if exists) or DELETE (if exists))

E-mail registered ([OPTION] CHANGE E-MAIL)

SUBMIT CHANGES ([BUTTON])
 

0x0539

Retired Staff
Contributor
Jan 30, 2016
1,334
1,214
254
And if you have the time I will love to get a extended feature set, and if you do I would love you to help me, the urgent is what I posted first, this is only if you have time!

- Auto delete channels in 30 days if there is no activity;
- Register e-mail when create channels so that user can recover channel password if lost!
- Only one set of 5 channels per "client IP" and "UniqueID" (so when the client connects to the panel if he has any channel created a management pannel appears *);
- * When the client access the CREATE CHANNEL URL again, if the "client IP" or "unique ID" already has a channel, a panel is presented to manage the channels, like this:
Your Nickname ([ONLY READ])

Main Channel ([OPTION] CHANGE NAME and DETELE ALL MY CHANNELS)
Sub-Channel NAME 1 ([OPTION] CHANGE NAME and CAN NOT BE DELETED)
Sub-Channel NAME 2 ([OPTION] ADD (if does not exists) or CHANGE NAME (if exists) or DELETE (if exists))
Sub-Channel NAME 3 ([OPTION] ADD (if does not exists) or CHANGE NAME (if exists) or DELETE (if exists))
Sub-Channel NAME 4 ([OPTION] ADD (if does not exists) or CHANGE NAME (if exists) or DELETE (if exists))

E-mail registered ([OPTION] CHANGE E-MAIL)

SUBMIT CHANGES ([BUTTON])
Also get us a happy meal while you're at it, thanks!
 

anton

Member
Mar 4, 2016
8
0
36
[09-May-2016 00:04:54 America/Chicago] PHP Fatal error: Uncaught exception 'TeamSpeak3_Transport_Exception' with message 'Connection refused' in /home2/myshorna/public_html/createchannel/Transport/TCP.php:54
Stack trace:
#0 /home2/myshorna/public_html/createchannel/Transport/TCP.php(108): TeamSpeak3_Transport_TCP->connect()
#1 /home2/myshorna/public_html/createchannel/Adapter/ServerQuery.php(76): TeamSpeak3_Transport_TCP->readLine()
#2 /home2/myshorna/public_html/createchannel/Adapter/Abstract.php(60): TeamSpeak3_Adapter_ServerQuery->syn()
#3 /home2/myshorna/public_html/createchannel/TeamSpeak3.php(320): TeamSpeak3_Adapter_Abstract->__construct(Array)
#4 /home2/myshorna/public_html/createchannel/crear.php(16): TeamSpeak3::factory('serverquery://s...')
#5 {main}
thrown in /home2/myshorna/public_html/createchannel/Transport/TCP.php on line 54


Getting This Error When I Use This On My Website.
 
Last edited by a moderator:

hackerpedro

Member
May 7, 2016
34
1
43
[09-May-2016 00:04:54 America/Chicago] PHP Fatal error: Uncaught exception 'TeamSpeak3_Transport_Exception' with message 'Connection refused' in /home2/myshorna/public_html/createchannel/Transport/TCP.php:54
Stack trace:
#0 /home2/myshorna/public_html/createchannel/Transport/TCP.php(108): TeamSpeak3_Transport_TCP->connect()
#1 /home2/myshorna/public_html/createchannel/Adapter/ServerQuery.php(76): TeamSpeak3_Transport_TCP->readLine()
#2 /home2/myshorna/public_html/createchannel/Adapter/Abstract.php(60): TeamSpeak3_Adapter_ServerQuery->syn()
#3 /home2/myshorna/public_html/createchannel/TeamSpeak3.php(320): TeamSpeak3_Adapter_Abstract->__construct(Array)
#4 /home2/myshorna/public_html/createchannel/crear.php(16): TeamSpeak3::factory('serverquery://s...')
#5 {main}
thrown in /home2/myshorna/public_html/createchannel/Transport/TCP.php on line 54


Getting This Error When I Use This On My Website.

Have you added your host IP to the serverquery whitelist txt?
 

hackerpedro

Member
May 7, 2016
34
1
43
Yes. The Script does not connect to the server when I check "Server Log" But this script works fine on wampserver
SO the problem is in your PHP! either the version or some module that needs to be activated! If you host the script yourself you just have to look in to PHP version and make sure is 5.5+ and in the modules section, well, here you just have to dig a litlle, i'm not sure what may be cousing this! If you host is rented, then just contact the host administrator and ask him to resolve this PHP error!
 
Top