[php] Kick users who put a domain, ip address or Swear Words in the channel name.

adonradon

Member
Jul 13, 2016
27
17
50
The script auto-kicks users from the created channel back to the lobby if they attempt to create a channel with 5 or more numbers in the title. It's for stopping users from advertising with IPs
For example: "If you want to block "Swear Words" in channel name. You can block with this script or whatever you want"

1-) chmod +x channelcontroller.sh
2-) Edit Config.cfg with your informations
3-) ./channelcontroller.sh start/stop
4-) You must use PHP 5.5+

Thanks For Help @Eskirex




PHP:
.com , .net , .org , .xyz , .info , .pro , .tk , .work

PHP:
            if($cfg['kickchannel']){
                if(StriStr($channelnames['channel_name'] , ".net")){
                    $tsAdmin->channelDelete($channelnames['cid'], 1);
                }
            }
 
Last edited:

adonradon

Member
Jul 13, 2016
27
17
50
* CHANGELOG

I added Domain Check(Action: Delete) If channel names is including Domain Address like ".net" , ".com" such and such.
 

FarisDev

L oryh brx
Contributor
Jun 9, 2016
277
111
107
The script auto-kicks users from the created channel back to the lobby if they attempt to create a channel with 5 or more numbers in the title. It's for stopping users from advertising with IPs
For example: "If you want to block "Swear Words" in channel name. You can block with this script or whatever you want"

1-) chmod +x channelcontroller.sh
2-) Edit Config.cfg with your informations
3-) ./channelcontroller.sh start/stop
4-) You must use PHP 5.5+




PHP:
.com , .net , .org , .xyz , .info , .pro , .tk , .work

PHP:
            if($cfg['kickchannel']){
                if(StriStr($channelnames['channel_name'] , ".net")){
                    $tsAdmin->channelDelete($channelnames['cid'], 1);
                }
            }
Can U give me code for Ban? i dont wanna kick , and keep going your work ur the best :)
 

adonradon

Member
Jul 13, 2016
27
17
50
Can U give me code for Ban? i dont wanna kick , and keep going your work ur the best :)
I'm busy now, I will look for u... because it is not easy I have to do channelGroupList ( ) etc... but If u want for Client Controller Client Controller (Action: BAN)
PHP:
            // 0 = permanently u can write there secs like 1 hour / 3600
            if($cfg['kickclient']){
                if(StriStr($clientname['client_nickname'] , "test")){
                    $tsAdmin->banClient($clientname['clid'], 0, $cfg['clientkickmessage']);
                }
            }

thanks for ur comment :)
 

FarisDev

L oryh brx
Contributor
Jun 9, 2016
277
111
107
I'm busy now, I will look for u... because it is not easy I have to do channelGroupList ( ) etc... but If u want for Client Controller Client Controller (Action: BAN)
PHP:
            // 0 = permanently u can write there secs like 1 hour / 3600
            if($cfg['kickclient']){
                if(StriStr($clientname['client_nickname'] , "test")){
                    $tsAdmin->banClient($clientname['clid'], 0, $cfg['clientkickmessage']);
                }
            }

thanks for ur comment :)
Thank you very much but can i question you ? why u dont add a function - like cfg['client....']
and add a more functions on the bot like ( if hes swearing in private message like **** You ) banned him ,
 

adonradon

Member
Jul 13, 2016
27
17
50
Thank you very much but can i question you ? why u dont add a function - like cfg['client....']
and add a more functions on the bot like ( if hes swearing in private message like **** You ) banned him ,

Actually I will develop Client Controller and Channel Controler but trust me I am so busy. I'm cyber security expert and always, I watch my network for security as I said I will develop both If I have free time and as u said I will add into the config as much as I can
"( if hes swearing in private message like **** You ) " I think that it is about Client Plugin maybe but I will check for u
 

FarisDev

L oryh brx
Contributor
Jun 9, 2016
277
111
107
Actually I will develop Client Controller and Channel Controler but trust me I am so busy. I'm cyber security expert and always, I watch my network for security as I said I will develop both If I have free time and as u said I will add into the config as much as I can
"( if hes swearing in private message like **** You ) " I think that it is about Client Plugin maybe but I will check for u
i can help you and yeah, :D i want to contact you in ts3. please pm ts3 server.
 

adonradon

Member
Jul 13, 2016
27
17
50
Hi adonradon ,

This script has Ignored channels (ids)?

as far as I understand "u want to say that for example u want to ignore/exception to channel" like
(channel name is test Action: delete except channel ID 100) but I didn't do exception any channel but I will develop this script If I have free time
 

linuxman

Member
Feb 8, 2016
69
12
46
Hi ,

I upload this script on my server, connected bot my ts but not working!!!(takes no action) Can someone help me?Thanks.
 
Last edited:

adonradon

Member
Jul 13, 2016
27
17
50
Hi adonradon ,
Can u check this code If u want to do exception some channel ID
This script has Ignored channels (ids)?
PHP:
<?php
require('ts3admin.class.php');
require('config.php');

$tsAdmin = new ts3admin($ts3['ip'], $ts3['queryport']);

if($tsAdmin->getElement('success', $tsAdmin->connect())) {
    $tsAdmin->login($ts3['user'], $ts3['pass']);
    $tsAdmin->selectServer($ts3['port']);
    $tsAdmin->setName($ts3['name']);
   
    while(true){
        $channel = $tsAdmin->channelList();
        foreach($channel['data'] as $channelnames)
        {
        //    Forexample: if($channelnames['cid'] != 67)
            if($channelnames['cid'] != channelidhere){
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".com")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".net")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".org")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".xyz")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".info")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".pro")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".tk")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".work")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(preg_match_all( "/[0-9]/", $channelnames['channel_name'] ) > 5){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
            }
        }
    }
}   
?>
 

Najsr

Moderator
TeamSpeak Developer
Apr 23, 2016
483
249
167
PHP:
if($channelnames['cid'] == 67) continue;
Easier method. (If it equals automatically jumps to another loop)
 

adonradon

Member
Jul 13, 2016
27
17
50
PHP:
if($channelnames['cid'] == 67) continue;
Easier method. (If it equals automatically jumps to another loop)
Thanks actually it does not matter but thanks for advice I think it will help him
 

linuxman

Member
Feb 8, 2016
69
12
46
PHP:
<?php
require('ts3admin.class.php');
require('config.php');

$tsAdmin = new ts3admin($ts3['ip'], $ts3['queryport']);

if($tsAdmin->getElement('success', $tsAdmin->connect())) {
    $tsAdmin->login($ts3['user'], $ts3['pass']);
    $tsAdmin->selectServer($ts3['port']);
    $tsAdmin->setName($ts3['name']);
  
    while(true){
        $channel = $tsAdmin->channelList();
        foreach($channel['data'] as $channelnames)
        {
        //    Forexample: if($channelnames['cid'] != 67)
            if($channelnames['cid'] != channelidhere){
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".com")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".net")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".org")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".xyz")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".info")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".pro")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".tk")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(StriStr($channelnames['channel_name'] , ".work")){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
                if($cfg['kickchannel']){
                    if(preg_match_all( "/[0-9]/", $channelnames['channel_name'] ) > 5){
                        $tsAdmin->channelDelete($channelnames['cid'], 1);
                    }
                }
            }
        }
    }
}  
?>

:eek: I love you :confused: Thanks to the remembered..
 
Top