Hi guys
I recently tried to make an automated channel script webinterface, my script was a complete shit, so I just went with the AnonymousSV script, I modified the script and it works fine when you have admin permissions in the server, but it doesnt work for members. The script requests permission that if I give them to members they will be creating channels everywere. Help me fix this pls

PHP Code:
<?php

//////////////////////////////////////////////////////////////////////
//'########::'######::'########:'##::::'##::'######::::::'###::::::://
//... ##..::'##... ##:... ##..:: ##:::: ##:'##... ##::::'## ##:::::://
//::: ##:::: ##:::..::::: ##:::: ##:::: ##: ##:::..::::'##:. ##::::://
//::: ##::::. ######::::: ##:::: ##:::: ##: ##::'####:'##:::. ##:::://
//::: ##:::::..... ##:::: ##:::: ##:::: ##: ##::: ##:: #########:::://
//::: ##::::'##::: ##:::: ##:::: ##:::: ##: ##::: ##:: ##.... ##:::://
//::: ##::::. ######::::: ##::::. #######::. ######::: ##:::: ##:::://
//:::..::::::......::::::..::::::.......::::......::::..:::::..::::://
//////////////////////////////////////////////////////////////////////
//            SCRIPT MADE BY AnonymousSV                                 //
//                                                                    //
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////

    /* Connect to server query */                       
        
$server = array(
            
"tsip" => "127.0.0.1",
            
"tsport" => "9987",
            
"ts_query_admin" => "serverqueryname",
            
"ts_query_password" => "password",
            
"ts_query_port" => "Query Port | Default:10011",
        );
    
    
/* Connect to server query */                       
    
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////

    
error_reporting(0);

    
/* TeamSpeak3 PHP FrameWork Library */
    
require_once('TeamSpeak3.php'); 

    
    try{
    
    
/* Conect to the server querry */
    
TeamSpeak3::init();

    
$ts3_VirtualServer TeamSpeak3::factory("serverquery://".$server["ts_query_admin"].":".$server["ts_query_password"]."@".$server["tsip"].":".$server["ts_query_port"]."/?server_port=".$server["tsport"]);

));
    
/* Gets the client IP ( WEB ) */
    
function getClientIp() {
            if (!empty(
$_SERVER['HTTP_CLIENT_IP']))
                return 
$_SERVER['HTTP_CLIENT_IP'];
            else if(!empty(
$_SERVER['HTTP_X_FORWARDED_FOR']))
                return 
$_SERVER['HTTP_X_FORWARDED_FOR'];
            else if(!empty(
$_SERVER['HTTP_X_FORWARDED']))
                return 
$_SERVER['HTTP_X_FORWARDED'];
            else if(!empty(
$_SERVER['HTTP_FORWARDED_FOR']))
                return 
$_SERVER['HTTP_FORWARDED_FOR'];
            else if(!empty(
$_SERVER['HTTP_FORWARDED']))
                return 
$_SERVER['HTTP_FORWARDED'];
            else if(!empty(
$_SERVER['REMOTE_ADDR']))
                return 
$_SERVER['REMOTE_ADDR'];
            else
                return 
false;
    }


            
/* Get the clients IP ( TS3 ) */
            
$ip $ts3_VirtualServer->clientList(array('client_type' => '0','connection_client_ip' => getClientIp()) )  ;
                
/* Compare the IPs */
                
foreach ($ip as $client) { 
                
/* Gets the client name */                
                
$IdClient $client->client_unique_identifier;
                break;
            }
  
        
/* Gets the info with $_POST */
            
$ChannelName $_POST['name'];
            
$SubChannelName $_POST['subname'];
            
$ChannelPassword $_POST['ChannelPass'];
            
$SubChannelPass $_POST['SubChannelPass'];

        
/* Saves to a string all channel names ( needed for next step ) */
        
$ListaDeChannels $ts3_VirtualServer->request("channellist")->toString();

        
/* Checks if there is an channel named as $channelname */
        
if (strpos($ListaDeChannels$ChannelName)) {
            echo 
"O canal jŠ existe";
            exit();
        }

        
/* Makes the channel */
        
$sub_cid $ts3_VirtualServer->channelCreate(array(
            
"channel_name" => $ChannelName,
            
"channel_password" => $ChannelPassword,
            
"channel_topic" => "Canal creat via EvDBoard",
            
"channel_flag_permanent" => TRUE,
            
"cpid"                   => '24852',
        ));


        
/* Makes the sub-channel */
        
$sub2_cid $ts3_VirtualServer->channelCreate(array(
            
"channel_name" => $SubChannelName,
            
"channel_password" => $ChannelPassword,
            
"channel_topic" => "Canal creat via EvDBoard"    ,
            
"channel_flag_permanent" => TRUE,
            
"cpid"                   => $sub_cid,
        ));

        
/* Move the client to the channel */
        
$clID $ts3_VirtualServer->clientGetByUid($IdClient);
        
$infoCliente $ts3_VirtualServer->execute("clientgetnamefromuid", array(
            
"cluid" => $IdClient
        
))->toList();
        
$cldbid strval($infoCliente['cldbid']);
        
$ts3_VirtualServer->execute("clientmove", array(
            
"clid" => $clID,
            
"cid" => $sub_cid
        
));
        
/* Client as Channel Admin */
        
$ts3_VirtualServer->execute("setclientchannelgroup", array(
            
"cldbid" => $cldbid,
            
"cid" => $sub_cid,
            
"cgid" => '2176'
        
));
        

    }
    
        
/* Shows the errors */
        
catch(Exception $e)
        {
                echo 
"Error (ID " $e->getCode() . ") <b>" $e->getMessage() . "</b>";

        }

?>