Need PHP Script for change permission on channels.

mkll11one

ServerGeek
VIP
Joined
Apr 26, 2016
Messages
261
Reaction score
133
Points
117
Location
Denmark
Hi,

I'm searching after A PHP script, (if it's possible) and make a script, where it will "change" on all virtualservers's channels, where this permission
Code:
i_channel_needed_permission_modify_power
need to changes to 75.

It will be a bit hard to change "manually on YaTQA"

If it could be possible, could be nice to hear, about someone could create the script! ;-)

Thank you =)

/mkll11one
 

Ondra3211

Contributor
Joined
May 5, 2018
Messages
66
Reaction score
41
Points
71
Location
Czech Republic
Here it is :)
PHP:
<?php
require_once("libraries/TeamSpeak3/TeamSpeak3.php");
try
{
   
  // IPv4 connection URI
  $uri = "serverquery://serveradmin:[email protected]:10011/?blocking=0";

  $ts3 = TeamSpeak3::factory($uri);
  $servers = $ts3->request("serverlist")->toAssocArray("virtualserver_id");
  foreach ($servers as $server) {
    $id = $server['virtualserver_id'];
  }

  $ts3->serverSelectById($id);
  $channels = $ts3->request("channellist")->toAssocArray("cid");
  foreach ($channels as $channel) {
    $cid = $channel['cid'];
      $ts3->execute("channeladdperm", array("cid" => $cid, "permsid" => "i_channel_needed_permission_modify_power", "permvalue" => 75));
  }
}

catch(TeamSpeak3_Exception $e)
{
  echo "Error " . $e->getCode() . ": " . $e->getMessage();
}
?>
 

Top