The ts3admin.class.php is a powerful library that offers functions to communicate with Teamspeak 3 Servers from your website!

You can do everything, your creativity knows no bounds! That library is faster than all other librarys because its optimized to find the shortest way to your information. No unneeded PHP 5 OOP Stuff, just the basics! There are a lot of professional developers and some big companys using my library. The best thing is that you can use it for free under the terms of the GNU General Public License v3. Take a look on the project website where you can find code examples, a manual and some other stuff.

author Par0noid Solutions
version 0.7.0.0
copyright Copyright (c) 2009-2014, Stefan Z.
package ts3admin
link http://ts3admin.info

 Methods

banAddByIp

banAddByIp(string $ip, integer $time, string $banreason) : array

Adds a new ban rule on the selected virtual server.

Output:

Array
{
 [banid] => 109
}
author Par0noid Solutions
access public

Parameters

$ip

string

clientIp

$time

integer

bantime in seconds (0=unlimited)

$banreason

string

Banreason [optional]

Returns

arraybanId

banAddByName

banAddByName(string $name, integer $time, string $banreason) : array

Adds a new ban rule on the selected virtual server.

Output:

Array
{
 [banid] => 111
}
author Par0noid Solutions
access public

Parameters

$name

string

clientName

$time

integer

bantime in seconds (0=unlimited)

$banreason

string

Banreason [optional]

Returns

arraybanId

banAddByUid

banAddByUid(string $uid, integer $time, string $banreason) : array

Adds a new ban rule on the selected virtual server.

Output:

Array
{
 [banid] => 110
}
author Par0noid Solutions
access public

Parameters

$uid

string

clientUniqueId

$time

integer

bantime in seconds (0=unlimited)

$banreason

string

Banreason [optional]

Returns

arraybanId

banClient

banClient(integer $clid, integer $time, string $banreason) : array

Bans the client specified with ID clid from the server. Please note that this will create two separate ban rules for the targeted clients IP address and his unique identifier.

Output:

Array
{
 [1] => 129
 [2] => 130
}
author Par0noid Solutions
access public

Parameters

$clid

integer

clientId

$time

integer

bantime in seconds (0=unlimited)

$banreason

string

Banreason [optional]

Returns

arraybanIds

banDelete

banDelete(integer $banID) : boolean

Deletes the ban rule with ID banid from the server.

author Par0noid Solutions
access public

Parameters

$banID

integer

banID

Returns

booleansuccess

banDeleteAll

banDeleteAll() : boolean

Deletes all active ban rules from the server.

author Par0noid Solutions
access public

Returns

booleansuccess

banList

banList() : array

Displays a list of active bans on the selected virtual server.

Output:

Array
{
 [banid] => 131
 [ip] => 1.2.3.4
 [name] => eugen
 [uid] => IYAntAcZHgVC7s3n3DNWmuJB/aM=
 [created] => 1286660391
 [duration] => 0
 [invokername] => Par0noid
 [invokercldbid] => 2086
 [invokeruid] => nUixbsq/XakrrmbqU8O30R/D8Gc=
 [reason] => insult
 [enforcements] => 0
}
author Par0noid Solutions
access public

Returns

arraybanlist

bindingList

bindingList() : array

Displays a list of IP addresses used by the server instance on multi-homed machines.

Output:

Array
{
 [ip] => 0.0.0.0
}
author Par0noid Solutions
access public

Returns

arraybindingList

channelAddPerm

channelAddPerm(integer $cid, array $permissions) : boolean

Adds a set of specified permissions to a channel. Multiple permissions can be added by providing the two parameters of each permission. A permission can be specified by permid or permsid.

Input-Array like this:

$permissions = array();
$permissions['permissionID'] = 'permissionValue';
//or you could use Permission Name
$permissions['permissionName'] = 'permissionValue';
author Par0noid Solutions
access public

Parameters

$cid

integer

channelId

$permissions

array

permissions

Returns

booleansuccess

channelClientAddPerm

channelClientAddPerm(integer $cid, integer $cldbid, array $permissions) : boolean

Adds a set of specified permissions to a client in a specific channel. Multiple permissions can be added by providing the three parameters of each permission. A permission can be specified by permid or permsid.

Input-Array like this:

$permissions = array();
$permissions['permissionID'] = 'permissionValue';
//or you could use Permission Name
$permissions['permissionName'] = 'permissionValue';
author Par0noid Solutions
access public

Parameters

$cid

integer

channelID

$cldbid

integer

clientDBID

$permissions

array

permissions

Returns

booleansuccess

channelClientDelPerm

channelClientDelPerm(integer $cid, integer $cldbid, array $permissions) : boolean

Removes a set of specified permissions from a client in a specific channel. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.

Input-Array like this:

$permissions = array();
$permissions[] = 'permissionID';
$permissions[] = 'permissionName';
//or
$permissions = array('permissionID', 'permissionName', 'permissionID');
author Par0noid Solutions
access public

Parameters

$cid

integer

channelID

$cldbid

integer

clientDBID

$permissions

array

permissions

Returns

booleansuccess

channelClientPermList

channelClientPermList(integer $cid, integer $cldbid, boolean $permsid) : array

Displays a list of permissions defined for a client in a specific channel.

Output:

Array
{
 [cid] => 250 (only in first result)
 [cldbid] => 2086 (only in first result)
 [permid] => 12876 (if permsid = false)
 [permsid] => b_client_info_view (if permsid = true)
 [permvalue] => 1
 [permnegated] => 0
 [permskip] => 0
}
author Par0noid Solutions
access public

Parameters

$cid

integer

channelID

$cldbid

integer

clientDBID

$permsid

boolean

displays permissionName instead of permissionID

Returns

arraychannelclientpermlist

channelCreate

channelCreate(array $data) : array

Creates a new channel using the given properties and displays its ID. Note that this command accepts multiple properties which means that you're able to specifiy all settings of the new channel at once.

Hint: don't forget to set channel_flag_semi_permanent = 1 or channel_flag_permanent = 1

Hint: you'll get an error if you want to create a channel without channel_name

Input-Array like this:

$data = array();

$data['setting'] = 'value';
$data['setting'] = 'value';

Output:

Array
{
 [cid] => 257
}
author Par0noid Solutions
access public

Parameters

$data

array

properties

Returns

arraychannelInfo

channelDelPerm

channelDelPerm(integer $cid, array $permissions) : boolean

Removes a set of specified permissions from a channel. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.

Input-Array like this:

$permissions = array();
$permissions[] = 'permissionID';
//or you could use
$permissions[] = 'permissionName';
author Par0noid Solutions
access public

Parameters

$cid

integer

channelID

$permissions

array

permissions

Returns

booleansuccess

channelDelete

channelDelete(integer $cid, integer $force) : boolean

Deletes an existing channel by ID. If force is set to 1, the channel will be deleted even if there are clients within. The clients will be kicked to the default channel with an appropriate reason message.

author Par0noid Solutions
access public

Parameters

$cid

integer

channelID

$force

integer

{1|0} (default: 1)

Returns

booleansuccess

channelEdit

channelEdit(integer $cid, array $data) : boolean

Changes a channels configuration using given properties. Note that this command accepts multiple properties which means that you're able to change all settings of the channel specified with cid at once.

Input-Array like this:

$data = array();

$data['setting'] = 'value';
$data['setting'] = 'value';
author Par0noid Solutions
access public

Parameters

$cid

integer

$channelID

$data

array

edited settings

Returns

booleansuccess

channelFind

channelFind(string $pattern) : array

displays a list of channels matching a given name pattern.

Output:

Array
{
 [cid] => 2
 [channel_name] => Lobby
}
author Par0noid Solutions
access public

Parameters

$pattern

string

channelName

Returns

arraychannelList

channelGroupAdd

channelGroupAdd(integer $name, integer $type) : boolean

Creates a new channel group using a given name and displays its ID. The optional type parameter can be used to create ServerQuery groups and template groups.

groupDbTypes:

  1. template group (used for new virtual servers)
  2. regular group (used for regular clients)
  3. global query group (used for ServerQuery clients)

Output:

Array
{
 [cgid] => 86
}
author Par0noid Solutions
access public

Parameters

$name

integer

groupName

$type

integer

groupDbType [optional] (default: 1)

Returns

booleansuccess

channelGroupAddPerm

channelGroupAddPerm(integer $cgid, array $permissions) : boolean

Adds a set of specified permissions to a channel group. Multiple permissions can be added by providing the two parameters of each permission. A permission can be specified by permid or permsid.

Input-Array like this:

$permissions = array();
$permissions['permissionID'] = 'permissionValue';
//or you could use:
$permissions['permissionName'] = 'permissionValue';
author Par0noid Solutions
access public

Parameters

$cgid

integer

channelGroupID

$permissions

array

permissions

Returns

booleansuccess

channelGroupClientList

channelGroupClientList(integer $cid, integer $cldbid, integer $cgid) : array

Displays all the client and/or channel IDs currently assigned to channel groups. All three parameters are optional so you're free to choose the most suitable combination for your requirement

Output:

Array
{
 [cid] => 2
 [cldbid] => 9
 [cgid] => 9
}
author Par0noid Solutions
access public

Parameters

$cid

integer

channelID [optional]

$cldbid

integer

clientDBID [optional]

$cgid

integer

channelGroupID [optional]

Returns

arraychannelGroupClientList

channelGroupCopy

channelGroupCopy(integer $scgid, integer $tcgid, integer $name, integer $type) : array

Creates a copy of the channel group specified with scgid. If tcgid is set to 0, the server will create a new group. To overwrite an existing group, simply set tcgid to the ID of a designated target group. If a target group is set, the name parameter will be ignored. The type parameter can be used to create ServerQuery groups and template groups.

groupDbTypes:

  1. template group (used for new virtual servers)
  2. regular group (used for regular clients)
  3. global query group (used for ServerQuery clients)

Output:

Array
{
 [cgid] => 86
}
author Par0noid Solutions
access public

Parameters

$scgid

integer

sourceChannelGroupID

$tcgid

integer

targetChannelGroupID

$name

integer

groupName

$type

integer

groupDbType

Returns

arraygroupId

channelGroupDelPerm

channelGroupDelPerm(integer $cgid, array $permissions) : boolean

Removes a set of specified permissions from the channel group. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.

Input-Array like this:

$permissions = array();
$permissions[] = 'permissionID';
$permissions[] = 'permissionName';
author Par0noid Solutions
access public

Parameters

$cgid

integer

channelGroupID

$permissions

array

permissions

Returns

booleansuccess

channelGroupDelete

channelGroupDelete(integer $cgid, integer $force) : boolean

Deletes a channel group by ID. If force is set to 1, the channel group will be deleted even if there are clients within.

author Par0noid Solutions
access public

Parameters

$cgid

integer

channelGroupID

$force

integer

forces deleting channelGroup (default: 1)

Returns

booleansuccess

channelGroupList

channelGroupList() : array

Displays a list of channel groups available on the selected virtual server.

Output:

Array
{
 [cgid] => 3
 [name] => Testname
 [type] => 0
 [iconid] => 100
 [savedb] => 1
 [sortid] => 0
 [namemode] => 0
 [n_modifyp] => 75
 [n_member_addp] => 50
 [n_member_removep] => 50
}
author Par0noid Solutions
access public

Returns

arraychannelGroupList

channelGroupPermList

channelGroupPermList(integer $cgid, boolean $permsid) : array

Displays a list of permissions assigned to the channel group specified with cgid. If the permsid option is specified, the output will contain the permission names instead of the internal IDs.

Output:

Array
{
 [permid] => 8471 (displayed if permsid is false)
 [permsid] => i_channel_create_modify_with_codec_latency_factor_min (displayed if permsid is true)
 [permvalue] => 1
 [permnegated] => 0
 [permskip] => 0
}
author Par0noid Solutions
access public

Parameters

$cgid

integer

channelGroupID

$permsid

boolean

permsid

Returns

arraychannelGroupPermlist

channelGroupRename

channelGroupRename(integer $cgid, integer $name) : boolean

Changes the name of a specified channel group.

author Par0noid Solutions
access public

Parameters

$cgid

integer

groupID

$name

integer

groupName

Returns

booleansuccess

channelInfo

channelInfo(integer $cid) : array

Displays detailed configuration information about a channel including ID, topic, description, etc.

Output:

Array
{
 [pid] => 0
 [channel_name] => Test
 [channel_topic] =>
 [channel_description] =>
 [channel_password] => cc97Pm4oOYq0J9fXDAgiWv/qScQ=
 [channel_codec] => 2
 [channel_codec_quality] => 7
 [channel_maxclients] => -1
 [channel_maxfamilyclients] => -1
 [channel_order] => 1
 [channel_flag_permanent] => 1
 [channel_flag_semi_permanent] => 0
 [channel_flag_default] => 0
 [channel_flag_password] => 0
 [channel_codec_latency_factor] => 1
 [channel_codec_is_unencrypted] => 1
 [channel_flag_maxclients_unlimited] => 1
 [channel_flag_maxfamilyclients_unlimited] => 0
 [channel_flag_maxfamilyclients_inherited] => 1
 [channel_filepath] => files\\virtualserver_1\\channel_2
 [channel_needed_talk_power] => 0
 [channel_forced_silence] => 0
 [channel_name_phonetic] =>
 [channel_icon_id] => 0
 [seconds_empty] => 61 (If it's a temporary channel with a channel delete delay)
}
author Par0noid Solutions
access public

Parameters

$cid

integer

channelID

Returns

arraychannelInfo

channelList

channelList(string $params) : array

Displays a list of channels created on a virtual server including their ID, order, name, etc. The output can be modified using several command options.


Possible parameters: [-topic] [-flags] [-voice] [-limits] [-icon]

Output: (without parameters)

Array
{
 [cid] => 2
 [pid] => 0
 [channel_order] => 1
 [channel_name] => Test
 [total_clients] => 0
 [channel_needed_subscribe_power] => 0
}


Output: (from parameters)

Array
{
 [-topic] => [channel_topic] => Default Channel has no topic
 [-flags] => [channel_flag_default] => 1
 [-flags] => [channel_flag_password] => 0
 [-flags] => [channel_flag_permanent] => 1
 [-flags] => [channel_flag_semi_permanent] => 0
 [-voice] => [channel_codec] => 2
 [-voice] => [channel_codec_quality] => 7
 [-voice] => [channel_needed_talk_power] => 0
 [-limits] => [total_clients_family] => 1
 [-limits] => [channel_maxclients] => -1
 [-limits] => [channel_maxfamilyclients] => -1
 [-icon] => [channel_icon_id] => 0
}


Usage:

$ts3->channelList(); //No parameters
$ts3->channelList("-flags"); //Single parameter
$ts3->channelList("-topic -flags -voice -limits -icon"); //Multiple parameters / all


author Par0noid Solutions
access public

Parameters

$params

string

additional parameters [optional]

Returns

arraychannelList

channelMove

channelMove(integer $cid, integer $cpid, integer $order) : boolean

Moves a channel to a new parent channel with the ID cpid. If order is specified, the channel will be sorted right under the channel with the specified ID. If order is set to 0, the channel will be sorted right below the new parent.

author Par0noid Solutions
access public

Parameters

$cid

integer

channelID

$cpid

integer

channelParentID

$order

integer

channelSortOrder

Returns

booleansuccess

channelPermList

channelPermList(integer $cid, boolean $permsid) : array

Displays a list of permissions defined for a channel.

Output:

Array
{
 [cid] => 2 (only in first result)
 [permid] => 8471 (if permsid = false)
 [permsid] => i_channel_needed_delete_power (if permsid = true)
 [permvalue] => 1
 [permnegated] => 0
 [permskip] => 0
}
author Par0noid Solutions
access public

Parameters

$cid

integer

channelID

$permsid

boolean

displays permissionName instead of permissionID [optional]

Returns

arraychannelpermlist

clientAddPerm

clientAddPerm(integer $cldbid, array $permissions) : boolean

Adds a set of specified permissions to a client. Multiple permissions can be added by providing the three parameters of each permission. A permission can be specified by permid or permsid.

Input-Array like this:

$permissions = array();
$permissions['permissionID'] = array('permissionValue', 'permskip');
//or you could use Permission Name
$permissions['permissionName'] = array('permissionValue', 'permskip');
author Par0noid Solutions
access public

Parameters

$cldbid

integer

clientDBID

$permissions

array

permissions

Returns

booleansuccess

clientDbDelete

clientDbDelete(integer $cldbid) : boolean

Deletes a clients properties from the database.

author Par0noid Solutions
access public

Parameters

$cldbid

integer

clientDBID

Returns

booleansuccess

clientDbEdit

clientDbEdit(integer $cldbid, array $data) : boolean

Changes a clients settings using given properties.

Input-Array like this:

$data = array();

$data['property'] = 'value';
$data['property'] = 'value';
author Par0noid Solutions
access public

Parameters

$cldbid

integer

clientDBID

$data

array

clientProperties

Returns

booleansuccess

clientDbFind

clientDbFind(string $pattern, boolean $uid) : array

Displays a list of client database IDs matching a given pattern. You can either search for a clients last known nickname or his unique identity by using the -uid option.

Output:

Array
{
 [cldbid] => 2
}
author Par0noid Solutions
access public

Parameters

$pattern

string

clientName

$uid

boolean

set true to add -uid param [optional]

Returns

arrayclientList

clientDbInfo

clientDbInfo(integer $cldbid) : array

Displays detailed database information about a client including unique ID, creation date, etc.

Output:

Array
{
 [client_unique_identifier] => nUixbsq/XakrrmbqU8O30R/D8Gc=
 [client_nickname] => par0noid
 [client_database_id] => 2
 [client_created] => 1361027850
 [client_lastconnected] => 1361027850
 [client_totalconnections] => 1
 [client_flag_avatar] =>
 [client_description] =>
 [client_month_bytes_uploaded] => 0
 [client_month_bytes_downloaded] => 0
 [client_total_bytes_uploaded] => 0
 [client_total_bytes_downloaded] => 0
 [client_icon_id] => 0
 [client_base64HashClientUID] => jneilbgomklpfnkjclkoggokfdmdlhnbbpmdpagh
 [client_lastip] => 127.0.0.1
}
author Par0noid Solutions
access public

Parameters

$cldbid

integer

clientDBID

Returns

arrayclientDbInfo

clientDbList

clientDbList(integer $start, integer $duration, boolean $count) : array

Displays a list of client identities known by the server including their database ID, last nickname, etc.


Possible params: [start={offset}] [duration={limit}] [-count]

Output:

Array
{
 [count] => 1 (if count parameter is set)
 [cldbid] => 2
 [client_unique_identifier] => nUixbsq/XakrrmbqU8O30R/D8Gc=
 [client_nickname] => par0noid
 [client_created] => 1361027850
 [client_lastconnected] => 1361027850
 [client_totalconnections] => 1
 [client_description] =>
 [client_lastip] => 127.0.0.1
}
author Par0noid Solutions
access public

Parameters

$start

integer

offset [optional] (Default: 0)

$duration

integer

limit [optional] (Default: -1)

$count

boolean

set true to add -count param [optional]

Returns

arrayclientdblist

clientDelPerm

clientDelPerm(integer $cldbid, array $permissionIds) : boolean

Removes a set of specified permissions from a client. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.

Input-Array like this:

$permissions = array();
$permissions['permissionID'] = 'permissionValue';
//or you could use Permission Name
$permissions['permissionName'] = 'permissionValue';
author Par0noid Solutions
access public

Parameters

$cldbid

integer

clientDBID

$permissionIds

array

permissionIDs

Returns

booleansuccess

clientEdit

clientEdit(integer $clid, array $data) : boolean

Changes a clients settings using given properties.

Input-Array like this:

$data = array();

$data['property'] = 'value';
$data['property'] = 'value';
author Par0noid Solutions
access public

Parameters

$clid

integer

clientID

$data

array

clientProperties

Returns

booleansuccess

clientFind

clientFind(string $pattern) : array

Displays a list of clients matching a given name pattern.

Output:

Array
{
 [clid] => 18
 [client_nickname] => par0noid
}
author Par0noid Solutions
access public

Parameters

$pattern

string

clientName

Returns

arrayclienList

clientGetDbIdFromUid

clientGetDbIdFromUid(string $cluid) : array

Displays the database ID matching the unique identifier specified by cluid.

Output:

Array
{
 [cluid] => nUixbsq/XakrrmbqU8O30R/D8Gc=
 [cldbid] => 2
}
author Par0noid Solutions
access public

Parameters

$cluid

string

clientUID

Returns

arrayclientInfo

clientGetIds

clientGetIds(string $cluid) : array

Displays all client IDs matching the unique identifier specified by cluid.

Output:

Array
{
 [cluid] => nUixbdf/XakrrmsdffO30R/D8Gc=
 [clid] => 7
 [name] => Par0noid
}
author Par0noid Solutions
access public

Parameters

$cluid

string

clientUID

Returns

arrayclientList

clientGetNameFromDbid

clientGetNameFromDbid(integer $cldbid) : array

Displays the unique identifier and nickname matching the database ID specified by cldbid.

Output:

Array
{
 [cluid] => nUixbsq/XakrrmbqU8O30R/D8Gc=
 [cldbid] => 2
 [name] => Par0noid
}
author Par0noid Solutions
access public

Parameters

$cldbid

integer

clientDBID

Returns

arrayclientInfo

clientGetNameFromUid

clientGetNameFromUid(string $cluid) : array

Displays the database ID and nickname matching the unique identifier specified by cluid.

Output:

Array
{
 [cluid] => nUixbsq/XakrrmbqU8O30R/D8Gc=
 [cldbid] => 2
 [name] => Par0noid
}
author Par0noid Solutions
access public

Parameters

$cluid

string

clientUID

Returns

arrayclientInfo

clientInfo

clientInfo(integer $clid) : array

Displays detailed configuration information about a client including unique ID, nickname, client version, etc.

Output:

Array
{
 [cid] => 2
 [client_idle_time] => 4445369
 [client_unique_identifier] => nUixbsq/XakrrmbqU8O30R/D8Gc=
 [client_nickname] => par0noid
 [client_version] => 3.0.9.2 [Build: 1351504843]
 [client_platform] => Windows
 [client_input_muted] => 1
 [client_output_muted] => 1
 [client_outputonly_muted] => 0
 [client_input_hardware] => 1
 [client_output_hardware] => 1
 [client_default_channel] =>
 [client_meta_data] =>
 [client_is_recording] => 0
 [client_login_name] =>
 [client_database_id] => 2
 [client_channel_group_id] => 5
 [client_servergroups] => 6
 [client_created] => 1361027850
 [client_lastconnected] => 1361027850
 [client_totalconnections] => 1
 [client_away] => 0
 [client_away_message] =>
 [client_type] => 0
 [client_flag_avatar] =>
 [client_talk_power] => 75
 [client_talk_request] => 0
 [client_talk_request_msg] =>
 [client_description] =>
 [client_is_talker] => 0
 [client_month_bytes_uploaded] => 0
 [client_month_bytes_downloaded] => 0
 [client_total_bytes_uploaded] => 0
 [client_total_bytes_downloaded] => 0
 [client_is_priority_speaker] => 0
 [client_nickname_phonetic] =>
 [client_needed_serverquery_view_power] => 75
 [client_default_token] =>
 [client_icon_id] => 0
 [client_is_channel_commander] => 0
 [client_country] =>
 [client_channel_group_inherited_channel_id] => 2
 [client_base64HashClientUID] => jneilbgomklpfnkjclkoggokfdmdlhnbbpmdpagh
 [connection_filetransfer_bandwidth_sent] => 0
 [connection_filetransfer_bandwidth_received] => 0
 [connection_packets_sent_total] => 12130
 [connection_bytes_sent_total] => 542353
 [connection_packets_received_total] => 12681
 [connection_bytes_received_total] => 592935
 [connection_bandwidth_sent_last_second_total] => 82
 [connection_bandwidth_sent_last_minute_total] => 92
 [connection_bandwidth_received_last_second_total] => 84
 [connection_bandwidth_received_last_minute_total] => 88
 [connection_connected_time] => 5908749
 [connection_client_ip] => 127.0.0.1
}
author Par0noid Solutions
access public

Parameters

$clid

integer

clientID

Returns

arrayclientInformation

clientKick

clientKick(integer $clid, string $kickMode, string $kickmsg) : boolean

Kicks one or more clients specified with clid from their currently joined channel or from the server, depending on reasonid. The reasonmsg parameter specifies a text message sent to the kicked clients. This parameter is optional and may only have a maximum of 40 characters.

author Par0noid Solutions
access public

Parameters

$clid

integer

clientID

$kickMode

string

kickMode (server or channel) (Default: servera)

$kickmsg

string

kick reason [optional]

Returns

booleansuccess

clientList

clientList(string $params) : array

Displays a list of clients online on a virtual server including their ID, nickname, status flags, etc. The output can be modified using several command options. Please note that the output will only contain clients which are currently in channels you're able to subscribe to.


Possible params: [-uid] [-away] [-voice] [-times] [-groups] [-info] [-icon] [-country] [-ip] [-badges]

Output: (without parameters)

Array
{
 [clid] => 1
 [cid] => 1
 [client_database_id] => 2
 [client_nickname] => Par0noid
 [client_type] => 0
 [-uid] => [client_unique_identifier] => nUixbsq/XakrrmbqU8O30R/D8Gc=
 [-away] => [client_away] => 0
 [-away] => [client_away_message] =>
 [-voice] => [client_flag_talking] => 0
 [-voice] => [client_input_muted] => 0
 [-voice] => [client_output_muted] => 0
 [-voice] => [client_input_hardware] => 0
 [-voice] => [client_output_hardware] => 0
 [-voice] => [client_talk_power] => 0
 [-voice] => [client_is_talker] => 0
 [-voice] => [client_is_priority_speaker] => 0
 [-voice] => [client_is_recording] => 0
 [-voice] => [client_is_channel_commander] => 0
 [-times] => [client_idle_time] => 1714
 [-times] => [client_created] => 1361027850
 [-times] => [client_lastconnected] => 1361042955
 [-groups] => [client_servergroups] => 6,7
 [-groups] => [client_channel_group_id] => 8
 [-groups] => [client_channel_group_inherited_channel_id] => 1
 [-info] => [client_version] => 3.0.9.2 [Build: 1351504843]
 [-info] => [client_platform] => Windows
 [-icon] => [client_icon_id] => 0
 [-country] => [client_country] =>
 [-ip] => [connection_client_ip] => 127.0.0.1
 [-badges] => [client_badges] => Overwolf=0
}


Usage:

$ts3->clientList(); //No parameters
$ts3->clientList("-uid"); //Single parameter
$ts3->clientList("-uid -away -voice -times -groups -info -country -icon -ip -badges"); //Multiple parameters


author Par0noid Solutions
access public

Parameters

$params

string

additional parameters [optional]

Returns

arrayclientList

clientMove

clientMove(integer $clid, integer $cid, string $cpw) : boolean

Moves one or more clients specified with clid to the channel with ID cid. If the target channel has a password, it needs to be specified with cpw. If the channel has no password, the parameter can be omitted.

author Par0noid Solutions
access public

Parameters

$clid

integer

clientID

$cid

integer

channelID

$cpw

string

channelPassword [optional]

Returns

booleansuccess

clientPermList

clientPermList(\intege $cldbid, boolean $permsid) : array

Displays a list of permissions defined for a client.

Output:

Array
{
 [permid] => 20654 //with permsid = false
 [permsid] => b_client_ignore_bans //with permsid = true
 [permvalue] => 1
 [permnegated] => 0
 [permskip] => 0
}
author Par0noid Solutions
access public

Parameters

$cldbid

\intege

clientDBID

$permsid

boolean

set true to add -permsid param [optional]

Returns

arrayclientPermList

clientPoke

clientPoke(integer $clid, string $msg) : boolean

Sends a poke message to the client specified with clid.

author Par0noid Solutions
access public

Parameters

$clid

integer

clientID

$msg

string

pokeMessage

Returns

booleansuccess

clientSetServerQueryLogin

clientSetServerQueryLogin(string $username) : array

Updates your own ServerQuery login credentials using a specified username. The password will be auto-generated.

Output:

Array
{
 [client_login_password] => +r\/TQqvR
}
author Par0noid Solutions
access public

Parameters

$username

string

username

Returns

arrayuserInfomation

clientUpdate

clientUpdate(array $data) : boolean

Change your ServerQuery clients settings using given properties.

Input-Array like this:

$data = array();
$data['property'] = 'value';
$data['property'] = 'value';
author Par0noid Solutions
access public

Parameters

$data

array

clientProperties

Returns

booleansuccess

complainAdd

complainAdd(integer $tcldbid, string $msg) : boolean

Submits a complaint about the client with database ID tcldbid to the server.

author Par0noid Solutions
access public

Parameters

$tcldbid

integer

targetClientDBID

$msg

string

complainMessage

Returns

booleansuccess

complainDelete

complainDelete(integer $tcldbid, integer $fcldbid) : boolean

Deletes the complaint about the client with ID tcldbid submitted by the client with ID fcldbid from the server.

author Par0noid Solutions
access public

Parameters

$tcldbid

integer

targetClientDBID

$fcldbid

integer

fromClientDBID

Returns

booleansuccess

complainDeleteAll

complainDeleteAll(integer $tcldbid) : boolean

Deletes all complaints about the client with database ID tcldbid from the server.

author Par0noid Solutions
access public

Parameters

$tcldbid

integer

targetClientDBID

Returns

booleansuccess

complainList

complainList(string $tcldbid) : array

Displays a list of complaints on the selected virtual server. If tcldbid is specified, only complaints about the targeted client will be shown.

Output:

Array
{
 [tcldbid] => 2
 [tname] => par0noid
 [fcldbid] => 1
 [fname] => serveradmin from 127.0.0.1:6814
 [message] => Steals crayons
 [timestamp] => 1361044090
}
author Par0noid Solutions
access public

Parameters

$tcldbid

string

targetClientDBID [optional]

Returns

arraycomplainList

connect

connect() : boolean

Connects to a ts3instance query port

author Par0noid Solutions
access public

Returns

booleansuccess

convertSecondsToArrayTime

convertSecondsToArrayTime(integer $seconds) : array

Converts seconds to a array: time

Output:

Array
{
 [days] => 3
 [hours] => 9
 [minutes] => 45
 [seconds] => 17
}
author Par0noid Solutions
access public

Parameters

$seconds

integer

time in seconds

Returns

arraytime

convertSecondsToStrTime

convertSecondsToStrTime(integer $seconds) : string

Converts seconds to a strTime (bsp. 5d 1h 23m 19s)

author Par0noid Solutions
access public

Parameters

$seconds

integer

time in seconds

Returns

stringstrTime

execOwnCommand

execOwnCommand(string $mode, string $command) : mixed

executes a command that isn't defined in class and returns data like your propose

Modes:

  • 0: execute -> return boolean
  • 1: execute -> return normal array
  • 2: execute -> return multidimensional array
  • 3: execute -> return plaintext serverquery
author Par0noid Solutions
access public

Parameters

$mode

string

executionMode

$command

string

command

Returns

mixedresult

ftCreateDir

ftCreateDir(string $cid, string $cpw, string $dirname) : boolean

Creates new directory in a channels file repository.

author Par0noid Solutions
access public

Parameters

$cid

string

channelId

$cpw

string

channelPassword (leave blank if not needed)

$dirname

string

dirPath

Returns

booleansuccess

ftDeleteFile

ftDeleteFile(string $cid, string $cpw, array $files) : boolean

Deletes one or more files stored in a channels file repository.

Input-Array like this:

$files = array();

$files[] = '/pic1.jpg';
$files[] = '/dokumente/test.txt';
$files[] = '/dokumente';
author Par0noid Solutions
access public

Parameters

$cid

string

channelID

$cpw

string

channelPassword (leave blank if not needed)

$files

array

files

Returns

booleansuccess

ftDownloadFile

ftDownloadFile(array $data) : array

Ddownloads a file and returns its contents

author Par0noid Solutions
access public

Parameters

$data

array

return of ftInitDownload

Returns

arraydownloadedFile

ftGetFileInfo

ftGetFileInfo(string $cid, string $cpw, array $files) : boolean

Displays detailed information about one or more specified files stored in a channels file repository.

Input-Array like this:

$files = array();

$files[] = '/pic1.jpg';
$files[] = '/dokumente/test.txt';
$files[] = '/dokumente';


Output:

Array
{
 [cid] => 231
 [name] => /dfsdfsdf.txt
 [size] => 1412
 [datetime] => 1286634258
}
author Par0noid Solutions
access public

Parameters

$cid

string

channelID

$cpw

string

channelPassword (leave blank if not needed)

$files

array

files

Returns

booleansuccess

ftGetFileList

ftGetFileList(string $cid, string $cpw, string $path) : array

Displays a list of files and directories stored in the specified channels file repository.

Output:

Array
{
 [cid] => 231
 [path] => /
 [name] => Documents
 [size] => 0
 [datetime] => 1286633633
 [type] => 0
}
author Par0noid Solutions
access public

Parameters

$cid

string

channelID

$cpw

string

channelPassword (leave blank if not needed)

$path

string

filePath

Returns

arrayfileList

ftInitDownload

ftInitDownload(string $name, string $cid, string $cpw, integer $seekpos) : array

Initializes a file transfer download. clientftfid is an arbitrary ID to identify the file transfer on client-side. On success, the server generates a new ftkey which is required to start downloading the file through TeamSpeak 3's file transfer interface.

Output:

Array
{
 [clientftfid] => 89
 [serverftfid] => 3
 [ftkey] => jSzWiRmFGdZnoJzW7BSDYJRUWB2WAUhb
 [port] => 30033
 [size] => 94
}
author Par0noid Solutions
access public

Parameters

$name

string

filePath

$cid

string

channelID

$cpw

string

channelPassword (leave blank if not needed)

$seekpos

integer

seekpos (default = 0) [optional]

Returns

arrayinitDownloadFileInfo

ftInitUpload

ftInitUpload(string $filename, string $cid, integer $size, string $cpw, boolean $overwrite, boolean $resume) : array

Initializes a file transfer upload. clientftfid is an arbitrary ID to identify the file transfer on client-side. On success, the server generates a new ftkey which is required to start uploading the file through TeamSpeak 3's file transfer interface.

Output:

Array
{
 [clientftfid] => 84
 [serverftfid] => 41
 [ftkey] => HCnXpunOdAorqj3dGqfiuLszX18O0PHP
 [port] => 30033
 [seekpos] => 0
}
author Par0noid Solutions
access public

Parameters

$filename

string

filePath

$cid

string

channelID

$size

integer

fileSize in bytes

$cpw

string

channelPassword (leave blank if not needed)

$overwrite

boolean

overwrite [optional] (default = 0)

$resume

boolean

resume [optional] (default = 0)

Returns

arrayinitUploadFileInfo

ftList

ftList() : array

Displays a list of running file transfers on the selected virtual server. The output contains the path to which a file is uploaded to, the current transfer rate in bytes per second, etc

Output:

Array
{
 [clid] => 1
 [cldbid] => 2019
 [path] => files/virtualserver_11/channel_231
 [name] => 1285412348878.png
 [size] => 1161281
 [sizedone] => 275888
 [clientftfid] => 15
 [serverftfid] => 52
 [sender] => 0
 [status] => 1
 [current_speed] => 101037.4453
 [average_speed] => 101037.4453
 [runtime] => 2163
}
author Par0noid Solutions
access public

Returns

arrayfileTransferList

ftRenameFile

ftRenameFile(integer $cid, string $cpw, string $oldname, string $newname, string $tcid, string $tcpw) : boolean

Renames a file in a channels file repository. If the two parameters tcid and tcpw are specified, the file will be moved into another channels file repository.

author Par0noid Solutions
access public

Parameters

$cid

integer

channelID

$cpw

string

channelPassword (leave blank if not needed)

$oldname

string

oldFilePath

$newname

string

newFilePath

$tcid

string

targetChannelID [optional]

$tcpw

string

targetChannelPassword [optional]

Returns

booleansuccess

ftStop

ftStop(integer $serverftfid, boolean $delete) : boolean

Stops the running file transfer with server-side ID serverftfid.

author Par0noid Solutions
access public

Parameters

$serverftfid

integer

serverFileTransferID

$delete

boolean

delete incomplete file [optional] (default: true)

Returns

booleansuccess

ftUploadFile

ftUploadFile(array $data, string $uploadData) : array

Uploads a file to server To check if upload was successful, you have to search for this file in fileList after

author Par0noid Solutions
access public

Parameters

$data

array

return of ftInitUpload

$uploadData

string

data which should be uploaded

Returns

arrayresponse

getDebugLog

getDebugLog() : array

Returns the debug log

Output:

Array
{
 [0] => Error in login() on line 1908: ErrorID: 520 | Message: invalid loginname or password
 [1] => Error in selectServer() on line 2044: ErrorID: 1540 | Message: convert error
}
author Par0noid Solutions
access public

Returns

arraydebugLog

getElement

getElement(string $element, array $array) : mixed

Returns the given associated element from an array
This can be used to get a result in a one line operation

For example you got this array:

Array
{
 [success] => false
 [errors] => Array
 [data] => false
}


Now you can grab the element like this:

$ts = new ts3admin('***', '***');

if($ts->getElement('success', $ts->connect())) {
 //operation
}
author Par0noid Solutions
access public

Parameters

$element

string

key of element

$array

array

array

Returns

mixed

gm

gm(string $msg) : boolean

Sends a text message to all clients on all virtual servers in the TeamSpeak 3 Server instance.

author Par0noid Solutions
access public

Parameters

$msg

string

message

Returns

booleansuccess

hostInfo

hostInfo() : array

Displays detailed connection information about the server instance including uptime, number of virtual servers online, traffic information, etc.

Output:

Array
{
 [instance_uptime] => 19038
 [host_timestamp_utc] => 1361046825
 [virtualservers_running_total] => 1
 [virtualservers_total_maxclients] => 32
 [virtualservers_total_clients_online] => 1
 [virtualservers_total_channels_online] => 2
 [connection_filetransfer_bandwidth_sent] => 0
 [connection_filetransfer_bandwidth_received] => 0
 [connection_filetransfer_bytes_sent_total] => 0
 [connection_filetransfer_bytes_received_total] => 0
 [connection_packets_sent_total] => 24853
 [connection_bytes_sent_total] => 1096128
 [connection_packets_received_total] => 25404
 [connection_bytes_received_total] => 1153918
 [connection_bandwidth_sent_last_second_total] => 82
 [connection_bandwidth_sent_last_minute_total] => 81
 [connection_bandwidth_received_last_second_total] => 84
 [connection_bandwidth_received_last_minute_total] => 87
}
author Par0noid Solutions
access public

Returns

arrayhostInformation

instanceEdit

instanceEdit(array $data) : boolean

Changes the server instance configuration using given properties.

Input-Array like this:

$data = array();

$data['setting'] = 'value';
$data['setting'] = 'value';
author Par0noid Solutions
access public

Parameters

$data

array

instanceProperties

Returns

booleansuccess

instanceInfo

instanceInfo() : array

Displays the server instance configuration including database revision number, the file transfer port, default group IDs, etc.

Output:

Array
{
 [serverinstance_database_version] => 20
 [serverinstance_filetransfer_port] => 30033
 [serverinstance_max_download_total_bandwidth] => 18446744073709551615
 [serverinstance_max_upload_total_bandwidth] => 18446744073709551615
 [serverinstance_guest_serverquery_group] => 1
 [serverinstance_serverquery_flood_commands] => 10
 [serverinstance_serverquery_flood_time] => 3
 [serverinstance_serverquery_ban_time] => 600
 [serverinstance_template_serveradmin_group] => 3
 [serverinstance_template_serverdefault_group] => 5
 [serverinstance_template_channeladmin_group] => 1
 [serverinstance_template_channeldefault_group] => 4
 [serverinstance_permissions_version] => 15
}
author Par0noid Solutions
access public

Returns

arrayinstanceInformation

logAdd

logAdd(integer $logLevel, string $logMsg) : boolean

Writes a custom entry into the servers log. Depending on your permissions, you'll be able to add entries into the server instance log and/or your virtual servers log. The loglevel parameter specifies the type of the entry.

author Par0noid Solutions
access public

Parameters

$logLevel

integer

loglevel between 1 and 4

$logMsg

string

logMessage

Returns

booleansuccess

logView

logView(integer $lines, integer $reverse, integer $instance, integer $begin_pos) : \multidimensional-array

Displays a specified number of entries from the servers log. If instance is set to 1, the server will return lines from the master logfile (ts3server_0.log) instead of the selected virtual server logfile.

Output:

Array
{
 [last_pos] => 0
 [file_size] => 1085
 [l] => 2012-01-10 20:34:31.379260|INFO    |ServerLibPriv |   | TeamSpeak 3 Server 3.0.1 (2011-11-17 07:34:30)
}
{
 [l] => 2012-01-10 20:34:31.380260|INFO    |DatabaseQuery |   | dbPlugin name:    SQLite3 plugin, Version 2, (c)TeamSpeak Systems GmbH
}
{
 [l] => 2012-01-10 20:34:31.380260|INFO    |DatabaseQuery |   | dbPlugin version: 3.7.3
}
author Par0noid Solutions
access public

Parameters

$lines

integer

between 1 and 100

$reverse

integer

{1|0} [optional]

$instance

integer

{1|0} [optional]

$begin_pos

integer

{1|0} [optional]

Returns

\multidimensional-arraylogEntries

logout

logout() : boolean

Deselects the active virtual server and logs out from the server instance.

author Par0noid Solutions
access public

Returns

booleansuccess

permIdGetByName

permIdGetByName(string $permsids) : array

Displays the database ID of one or more permissions specified by permsid.

Input-Array like this:

$permissions = array();
$permissions[] = 'permissionName';


Output:

Array
{
 [permsid] => b_serverinstance_help_view
 [permid] => 4353
}
author Par0noid Solutions
access public

Parameters

$permsids

string

permNames

Returns

arraypermissionList

permOverview

permOverview(integer $cid, integer $cldbid, integer $permid, string $permsid) : array

Displays all permissions assigned to a client for the channel specified with cid. If permid is set to 0, all permissions will be displayed. A permission can be specified by permid or permsid.

Output:

Array
{
 [t] => 0
 [id1] => 2
 [id2] => 0
 [p] => 16777
 [v] => 1
 [n] => 0
 [s] => 0
}
author Par0noid Solutions
access public

Parameters

$cid

integer

cchannelId

$cldbid

integer

clientDbId

$permid

integer

permId (Default: 0)

$permsid

string

permName

Returns

arraypermOverview

permissionList

permissionList(boolean $new) : array

Displays a list of permissions available on the server instance including ID, name and description. If the new parameter is set the permissionlist will return with the new output format.

Output: (with new parameter)

[0] => Array
    (
        [num] => 1
        [group_id_end] => 0
        [pcount] => 0
    )

[1] => Array
    (
        [num] => 2
        [group_id_end] => 7
        [pcount] => 7
        [permissions] => Array
            (
                [0] => Array
                    (
                        [permid] => 1
                        [permname] => b_serverinstance_help_view
                        [permdesc] => Retrieve information about ServerQuery commands
                        [grantpermid] => 32769
                    )

                [1] => Array
                    (
                        [permid] => 2
                        [permname] => b_serverinstance_version_view
                        [permdesc] => Retrieve global server version (including platform and build number)
                        [grantpermid] => 32770
                    )

                [2] => Array
                    (
                        [permid] => 3
                        [permname] => b_serverinstance_info_view
                        [permdesc] => Retrieve global server information
                        [grantpermid] => 32771
                    )

                [3] => Array
                    (
                        [permid] => 4
                        [permname] => b_serverinstance_virtualserver_list
                        [permdesc] => List virtual servers stored in the database
                        [grantpermid] => 32772
                    )

                [4] => Array
                    (
                        [permid] => 5
                        [permname] => b_serverinstance_binding_list
                        [permdesc] => List active IP bindings on multi-homed machines
                        [grantpermid] => 32773
                    )

               [5] => Array
                    (
                        [permid] => 6
                        [permname] => b_serverinstance_permission_list
                        [permdesc] => List permissions available available on the server instance
                        [grantpermid] => 32774
                    )

                [6] => Array
                    (
                        [permid] => 7
                        [permname] => b_serverinstance_permission_find
                        [permdesc] => Search permission assignments by name or ID
                        [grantpermid] => 32775
                    )

            )

    )
author Par0noid Solutions
access public

Parameters

$new

boolean

[optional] add new parameter

Returns

arraypermissionList

selectServer

selectServer(integer $value, string $type, boolean $virtual) : boolean

Selects the virtual server specified with sid or port to allow further interaction. The ServerQuery client will appear on the virtual server and acts like a real TeamSpeak 3 Client, except it's unable to send or receive voice data. If your database contains multiple virtual servers using the same UDP port, use will select a random virtual server using the specified port.

author Par0noid Solutions
access public

Parameters

$value

integer

Port or ID

$type

string

value type ('port', 'serverId') (default='port')

$virtual

boolean

set true to add -virtual param [optional]

Returns

booleansuccess

sendMessage

sendMessage(integer $mode, integer $target, string $msg) : boolean

Sends a text message a specified target. The type of the target is determined by targetmode while target specifies the ID of the recipient, whether it be a virtual server, a channel or a client.
Hint: You can just write to the channel the query client is in. See link in description for details.

Modes:

  • 1: send to client
  • 2: send to channel
  • 3: send to server


Targets:

  • clientID
  • channelID
  • serverID
author Par0noid Solutions
access public
see http://forum.teamspeak.com/showthread.php/84280-Sendtextmessage-by-query-client

Parameters

$mode

integer

$target

integer

$msg

string

Message

Returns

booleansuccess

serverCreate

serverCreate(array $data) : array

Creates a new virtual server using the given properties and displays its ID, port and initial administrator privilege key. If virtualserver_port is not specified, the server will test for the first unused UDP port. The first virtual server will be running on UDP port 9987 by default. Subsequently started virtual servers will be running on increasing UDP port numbers.

Input-Array like this:

$data = array();

$data['setting'] = 'value';
$data['setting'] = 'value';


Output:

Array
{
 [sid] => 2
 [virtualserver_port] => 9988
 [token] => eKnFZQ9EK7G7MhtuQB6+N2B1PNZZ6OZL3ycDp2OW
}
author Par0noid Solutions
access public

Parameters

$data

array

serverSettings [optional]

Returns

arrayserverInfo

serverDelete

serverDelete(integer $sid) : boolean

Deletes the virtual server specified with sid. Please note that only virtual servers in stopped state can be deleted.

author Par0noid Solutions
access public

Parameters

$sid

integer

serverID

Returns

booleansuccess

serverEdit

serverEdit(array $data) : boolean

Changes the selected virtual servers configuration using given properties. Note that this command accepts multiple properties which means that you're able to change all settings of the selected virtual server at once.

Input-Array like this:

$data = array();

$data['setting'] = 'value';
$data['setting'] = 'value';
author Par0noid Solutions
access public

Parameters

$data

array

serverSettings

Returns

booleansuccess

serverGroupAdd

serverGroupAdd(integer $name, integer $type) : array

Creates a new server group using the name specified with name and displays its ID. The optional type parameter can be used to create ServerQuery groups and template groups. For detailed information, see

Output:

Array
{
 [sgid] => 86
}
author Par0noid Solutions
access public

Parameters

$name

integer

groupName

$type

integer

groupDbType (0 = template, 1 = normal, 2 = query | Default: 1)

Returns

arraygroupId

serverGroupAddClient

serverGroupAddClient(integer $sgid, integer $cldbid) : boolean

Adds a client to the server group specified with sgid. Please note that a client cannot be added to default groups or template groups.

author Par0noid Solutions
access public

Parameters

$sgid

integer

serverGroupId

$cldbid

integer

clientDBID

Returns

booleansuccess

serverGroupAddPerm

serverGroupAddPerm(integer $sgid, array $permissions) : boolean

Adds a set of specified permissions to the server group specified with sgid. Multiple permissions can be added by providing the four parameters of each permission. A permission can be specified by permid or permsid.

Input-Array like this:

$permissions = array();
$permissions['permissionID'] = array('permissionValue', 'permskip', 'permnegated');
//or you could use
$permissions['permissionName'] = array('permissionValue', 'permskip', 'permnegated');
author Par0noid Solutions
access public

Parameters

$sgid

integer

groupID

$permissions

array

permissions

Returns

booleansuccess

serverGroupClientList

serverGroupClientList(integer $sgid, boolean $names) : \multidimensional-array

Displays the IDs of all clients currently residing in the server group specified with sgid. If you're using the optional -names option, the output will also contain the last known nickname and the unique identifier of the clients.


Possible params: -names

Output: (with -names param)

Array
{
 [cldbid] => 2017
 [client_nickname] => Par0noid //with -names parameter
 [client_unique_identifier] => nUixbsq/XakrrmbqU8O30R/D8Gc=
}
author Par0noid Solutions
access public

Parameters

$sgid

integer

groupId

$names

boolean

set true to add -names param [optional]

Returns

\multidimensional-arrayserverGroupClientList

serverGroupCopy

serverGroupCopy(integer $ssgid, integer $tsgid, integer $name, integer $type) : array

Creates a copy of the server group specified with ssgid. If tsgid is set to 0, the server will create a new group. To overwrite an existing group, simply set tsgid to the ID of a designated target group. If a target group is set, the name parameter will be ignored.

Output:

Array
{
 [sgid] => 86
}
author Par0noid Solutions
access public

Parameters

$ssgid

integer

sourceGroupID

$tsgid

integer

targetGroupID

$name

integer

groupName

$type

integer

groupDbType (0 = template, 1 = normal, 2 = query | Default: 1)

Returns

arraygroupId

serverGroupDelete

serverGroupDelete(integer $sgid, integer $force) : boolean

Deletes the server group specified with sgid. If force is set to 1, the server group will be deleted even if there are clients within.

author Par0noid Solutions
access public

Parameters

$sgid

integer

serverGroupID

$force

integer

forces deleting group (Default: 1)

Returns

booleansuccess

serverGroupDeleteClient

serverGroupDeleteClient(integer $sgid, integer $cldbid) : boolean

Removes a client specified with cldbid from the server group specified with sgid.

author Par0noid Solutions
access public

Parameters

$sgid

integer

groupID

$cldbid

integer

clientDBID

Returns

booleansuccess

serverGroupDeletePerm

serverGroupDeletePerm(integer $sgid, array $permissionIds) : boolean

Removes a set of specified permissions from the server group specified with sgid. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.

Input-Array like this:

$permissions = array();
$permissions[] = 'permissionID';
//or you could use
$permissions[] = 'permissionName';
author Par0noid Solutions
access public

Parameters

$sgid

integer

serverGroupID

$permissionIds

array

permissionIds

Returns

booleansuccess

serverGroupList

serverGroupList() : array

Displays a list of server groups available. Depending on your permissions, the output may also contain global ServerQuery groups and template groups.

Output:

Array
{
 [sgid] => 1
 [name] => Guest Server Query
 [type] => 2
 [iconid] => 0
 [savedb] => 0
}
author Par0noid Solutions
access public

Returns

arrayserverGroupList

serverGroupPermList

serverGroupPermList(integer $sgid, boolean $permsid) : array

Displays a list of permissions assigned to the server group specified with sgid. If the permsid option is specified, the output will contain the permission names instead of the internal IDs.

Output:

Array
{
 [permid] => 12876 (if permsid = false)
 [permsid] => b_client_info_view (if permsid = true)
 [permvalue] => 1
 [permnegated] => 0
 [permskip] => 0
}
author Par0noid Solutions
access public

Parameters

$sgid

integer

serverGroupID

$permsid

boolean

set true to add -permsid param [optional]

Returns

arrayserverGroupPermList

serverGroupRename

serverGroupRename(integer $sgid, integer $name) : boolean

Changes the name of the server group specified with sgid.

author Par0noid Solutions
access public

Parameters

$sgid

integer

serverGroupID

$name

integer

groupName

Returns

booleansuccess

serverGroupsByClientID

serverGroupsByClientID(integer $cldbid) : array

Displays all server groups the client specified with cldbid is currently residing in.

Output:

Array
{
 [name] => Guest
 [sgid] => 73
 [cldbid] => 2
}
author Par0noid Solutions
access public

Parameters

$cldbid

integer

clientDBID

Returns

arrayserverGroupsByClientId

serverIdGetByPort

serverIdGetByPort(integer $port) : array

Displays the database ID of the virtual server running on the UDP port specified by virtualserver_port.

Output:

Array
{
 [server_id] => 1
}
author Par0noid Solutions
access public

Parameters

$port

integer

serverPort

Returns

arrayserverInfo

serverInfo

serverInfo() : array

Displays detailed configuration information about the selected virtual server including unique ID, number of clients online, configuration, etc.

Output:

Array
{
 [virtualserver_unique_identifier] => 2T3SRCPoWKojKlNMx6qxV7gOe8A=
 [virtualserver_name] => TeamSpeak ]I[ Server
 [virtualserver_welcomemessage] => Welcome to TeamSpeak
 [virtualserver_platform] => Windows
 [virtualserver_version] => 3.0.6.1 [Build: 1340956745]
 [virtualserver_maxclients] => 32
 [virtualserver_password] =>
 [virtualserver_clientsonline] => 2
 [virtualserver_channelsonline] => 2
 [virtualserver_created] => 1361027787
 [virtualserver_uptime] => 2804
 [virtualserver_codec_encryption_mode] => 0
 [virtualserver_hostmessage] =>
 [virtualserver_hostmessage_mode] => 0
 [virtualserver_filebase] => files\\virtualserver_1
 [virtualserver_default_server_group] => 8
 [virtualserver_default_channel_group] => 8
 [virtualserver_flag_password] => 0
 [virtualserver_default_channel_admin_group] => 5
 [virtualserver_max_download_total_bandwidth] => 18446744073709551615
 [virtualserver_max_upload_total_bandwidth] => 18446744073709551615
 [virtualserver_hostbanner_url] =>
 [virtualserver_hostbanner_gfx_url] =>
 [virtualserver_hostbanner_gfx_interval] => 0
 [virtualserver_complain_autoban_count] => 5
 [virtualserver_complain_autoban_time] => 1200
 [virtualserver_complain_remove_time] => 3600
 [virtualserver_min_clients_in_channel_before_forced_silence] => 100
 [virtualserver_priority_speaker_dimm_modificator] => -18.0000
 [virtualserver_id] => 1
 [virtualserver_antiflood_points_tick_reduce] => 5
 [virtualserver_antiflood_points_needed_command_block] => 150
 [virtualserver_antiflood_points_needed_ip_block] => 250
 [virtualserver_client_connections] => 1
 [virtualserver_query_client_connections] => 6
 [virtualserver_hostbutton_tooltip] =>
 [virtualserver_hostbutton_url] =>
 [virtualserver_hostbutton_gfx_url] =>
 [virtualserver_queryclientsonline] => 1
 [virtualserver_download_quota] => 18446744073709551615
 [virtualserver_upload_quota] => 18446744073709551615
 [virtualserver_month_bytes_downloaded] => 0
 [virtualserver_month_bytes_uploaded] => 0
 [virtualserver_total_bytes_downloaded] => 0
 [virtualserver_total_bytes_uploaded] => 0
 [virtualserver_port] => 9987
 [virtualserver_autostart] => 1
 [virtualserver_machine_id] =>
 [virtualserver_needed_identity_security_level] => 8
 [virtualserver_log_client] => 0
 [virtualserver_log_query] => 0
 [virtualserver_log_channel] => 0
 [virtualserver_log_permissions] => 1
 [virtualserver_log_server] => 0
 [virtualserver_log_filetransfer] => 0
 [virtualserver_min_client_version] => 12369
 [virtualserver_name_phonetic] =>
 [virtualserver_icon_id] => 0
 [virtualserver_reserved_slots] => 0
 [virtualserver_total_packetloss_speech] => 0.0000
 [virtualserver_total_packetloss_keepalive] => 0.0000
 [virtualserver_total_packetloss_control] => 0.0000
 [virtualserver_total_packetloss_total] => 0.0000
 [virtualserver_total_ping] => 0.0000
 [virtualserver_ip] =>
 [virtualserver_weblist_enabled] => 1
 [virtualserver_ask_for_privilegekey] => 0
 [virtualserver_hostbanner_mode] => 0
 [virtualserver_status] => online
 [connection_filetransfer_bandwidth_sent] => 0
 [connection_filetransfer_bandwidth_received] => 0
 [connection_filetransfer_bytes_sent_total] => 0
 [connection_filetransfer_bytes_received_total] => 0
 [connection_packets_sent_speech] => 0
 [connection_bytes_sent_speech] => 0
 [connection_packets_received_speech] => 0
 [connection_bytes_received_speech] => 0
 [connection_packets_sent_keepalive] => 2055
 [connection_bytes_sent_keepalive] => 84255
 [connection_packets_received_keepalive] => 2055
 [connection_bytes_received_keepalive] => 86309
 [connection_packets_sent_control] => 90
 [connection_bytes_sent_control] => 13343
 [connection_packets_received_control] => 90
 [connection_bytes_received_control] => 9176
 [connection_packets_sent_total] => 2145
 [connection_bytes_sent_total] => 97598
 [connection_packets_received_total] => 2145
 [connection_bytes_received_total] => 95485
 [connection_bandwidth_sent_last_second_total] => 82
 [connection_bandwidth_sent_last_minute_total] => 81
 [connection_bandwidth_received_last_second_total] => 84
 [connection_bandwidth_received_last_minute_total] => 87
}
author Par0noid Solutions
access public

Returns

arrayserverInformation

serverList

serverList(string $options) : array

Displays a list of virtual servers including their ID, status, number of clients online, etc. If you're using the -all option, the server will list all virtual servers stored in the database. This can be useful when multiple server instances with different machine IDs are using the same database. The machine ID is used to identify the server instance a virtual server is associated with. The status of a virtual server can be either online, offline, deploy running, booting up, shutting down and virtual online. While most of them are self-explanatory, virtual online is a bit more complicated. Please note that whenever you select a virtual server which is currently stopped, it will be started in virtual mode which means you are able to change its configuration, create channels or change permissions, but no regular TeamSpeak 3 Client can connect. As soon as the last ServerQuery client deselects the virtual server, its status will be changed back to offline.

Possible params: [-uid] [-short] [-all] [-onlyoffline]

Output:

Array
{
 [virtualserver_id] => 1 //displayed on -short
 [virtualserver_port] => 9987 //displayed on -short
 [virtualserver_status] => online //displayed on -short
 [virtualserver_clientsonline] => 2
 [virtualserver_queryclientsonline] => 1
 [virtualserver_maxclients] => 32
 [virtualserver_uptime] => 3045
 [virtualserver_name] => TeamSpeak ]I[ Server
 [virtualserver_autostart] => 1
 [virtualserver_machine_id] =>
 [-uid] => [virtualserver_unique_identifier] => bYrybKl/APfKq7xzpIJ1Xb6C06U=
}
author Par0noid Solutions
access public

Parameters

$options

string

optional parameters

Returns

arrayserverList

serverProcessStop

serverProcessStop() : boolean

Stops the entire TeamSpeak 3 Server instance by shutting down the process.

author Par0noid Solutions
access public

Returns

booleansuccess

serverRequestConnectionInfo

serverRequestConnectionInfo() : array

Displays detailed connection information about the selected virtual server including uptime, traffic information, etc.

Output:

Array
{
 [connection_filetransfer_bandwidth_sent] => 0
 [connection_filetransfer_bandwidth_received] => 0
 [connection_filetransfer_bytes_sent_total] => 0
 [connection_filetransfer_bytes_received_total] => 0
 [connection_packets_sent_total] => 3333
 [connection_bytes_sent_total] => 149687
 [connection_packets_received_total] => 3333
 [connection_bytes_received_total] => 147653
 [connection_bandwidth_sent_last_second_total] => 123
 [connection_bandwidth_sent_last_minute_total] => 81
 [connection_bandwidth_received_last_second_total] => 352
 [connection_bandwidth_received_last_minute_total] => 87
 [connection_connected_time] => 3387
 [connection_packetloss_total] => 0.0000
 [connection_ping] => 0.0000
}
author Par0noid Solutions
access public

Returns

arrayserverRequestConnectionInfo

serverSnapshotCreate

serverSnapshotCreate() : string

Displays a snapshot of the selected virtual server containing all settings, groups and known client identities. The data from a server snapshot can be used to restore a virtual servers configuration, channels and permissions using the serversnapshotdeploy command.

author Par0noid Solutions
access public

Returns

stringsnapshot

serverSnapshotDeploy

serverSnapshotDeploy(string $snapshot) : boolean

Restores the selected virtual servers configuration using the data from a previously created server snapshot. Please note that the TeamSpeak 3 Server does NOT check for necessary permissions while deploying a snapshot so the command could be abused to gain additional privileges.

author Par0noid Solutions
access public

Parameters

$snapshot

string

snapshot

Returns

booleansuccess

serverStart

serverStart(integer $sid) : boolean

Starts the virtual server specified with sid. Depending on your permissions, you're able to start either your own virtual server only or all virtual servers in the server instance.

author Par0noid Solutions
access public

Parameters

$sid

integer

serverID

Returns

booleansuccess

serverStop

serverStop(integer $sid) : boolean

Stops the virtual server specified with sid. Depending on your permissions, you're able to stop either your own virtual server only or all virtual servers in the server instance.

author Par0noid Solutions
access public

Parameters

$sid

integer

serverID

Returns

booleansuccess

serverTemppasswordAdd

serverTempPasswordAdd(string $pw, string $duration, string $desc, string $tcid, string $tcpw) : boolean

Sets a new temporary server password specified with pw. The temporary password will be valid for the number of seconds specified with duration. The client connecting with this password will automatically join the channel specified with tcid. If tcid is set to 0, the client will join the default channel.

author Par0noid Solutions
access public

Parameters

$pw

string

temporary password

$duration

string

durations in seconds

$desc

string

description [optional]

$tcid

string

cid user enters on connect (0 = Default channel) [optional]

$tcpw

string

channelPW

Returns

booleansuccess

serverTemppasswordDel

serverTempPasswordDel(string $pw) : boolean

Deletes the temporary server password specified with pw.

author Par0noid Solutions
access public

Parameters

$pw

string

temporary password

Returns

booleansuccess

serverTemppasswordList

serverTempPasswordList() : array

Returns a list of active temporary server passwords. The output contains the clear-text password, the nickname and unique identifier of the creating client.

Output:

Array
{
 [nickname] => serveradmin
 [uid] => 1
 [desc] => none
 [pw_clear] => test
 [start] => 1334996838
 [end] => 1335000438
 [tcid] => 0
}
author Par0noid Solutions
access public

Returns

arrayserverTemppasswordList

setClientChannelGroup

setClientChannelGroup(integer $cgid, integer $cid, integer $cldbid) : boolean

Sets the channel group of a client to the ID specified with cgid.

author Par0noid Solutions
access public

Parameters

$cgid

integer

groupID

$cid

integer

channelID

$cldbid

integer

clientDBID

Returns

booleansuccess

setName

setName(string $newName) : boolean

Sets your nickname in server query

author Par0noid Solutions
access public

Parameters

$newName

string

new name in server query

Returns

booleansuccess

succeeded

succeeded(array $array) : boolean

Succeeded will check the success element of a return array

$ts = new ts3admin('***', '***');

if($ts->succeeded($ts->connect())) {
 //operation
}
author Par0noid Solutions
access public

Parameters

$array

array

result

Returns

boolean

tokenAdd

tokenAdd(integer $tokentype, integer $tokenid1, integer $tokenid2, string $description, array $customFieldSet) : array

Create a new token. If tokentype is set to 0, the ID specified with tokenid1 will be a server group ID. Otherwise, tokenid1 is used as a channel group ID and you need to provide a valid channel ID using tokenid2. The tokencustomset parameter allows you to specify a set of custom client properties. This feature can be used when generating tokens to combine a website account database with a TeamSpeak user. The syntax of the value needs to be escaped using the ServerQuery escape patterns and has to follow the general syntax of:
ident=ident1 value=value1|ident=ident2 value=value2|ident=ident3 value=value3

Input-Array like this:

$customFieldSet = array();

$customFieldSet['ident'] = 'value';
$customFieldSet['ident'] = 'value';
author Par0noid Solutions
access public

Parameters

$tokentype

integer

token type

$tokenid1

integer

groupID

$tokenid2

integer

channelID

$description

string

token description [optional]

$customFieldSet

array

customFieldSet [optional]

Returns

arraytokenInformation

tokenDelete

tokenDelete(string $token) : boolean

Deletes an existing token matching the token key specified with token.

author Par0noid Solutions
access public

Parameters

$token

string

token

Returns

booleansuccess

tokenList

tokenList() : array

Displays a list of privilege keys available including their type and group IDs. Tokens can be used to gain access to specified server or channel groups. A privilege key is similar to a client with administrator privileges that adds you to a certain permission group, but without the necessity of a such a client with administrator privileges to actually exist. It is a long (random looking) string that can be used as a ticket into a specific server group.

Output:

Array
{
 [token] => GdqedxSEDle3e9+LtR3o9dO09bURH+vymvF5hOJg
 [token_type] => 0
 [token_id1] => 71
 [token_id2] => 0
 [token_created] => 1286625908
 [token_description] => for you
}
author Par0noid Solutions
access public

Returns

arraytokenListist

tokenUse

tokenUse(string $token) : boolean

Use a token key gain access to a server or channel group. Please note that the server will automatically delete the token after it has been used.

author Par0noid Solutions
access public

Parameters

$token

string

token

Returns

booleansuccess

version

version() : array

Displays the servers version information including platform and build number.

Output:

Array
{
 [version] => 3.0.6.1
 [build] => 1340956745
 [platform] => Windows
}
author Par0noid Solutions
access public

Returns

arrayversionInformation

whoAmI

whoAmI() : array

Displays information about your current ServerQuery connection including your loginname, etc.

Output:

Array
{
 [virtualserver_status] => online
 [virtualserver_id] => 1
 [virtualserver_unique_identifier] => bYrybKl/APfKq7xzpIJ1Xb6C06U=
 [virtualserver_port] => 9987
 [client_id] => 5
 [client_channel_id] => 1
 [client_nickname] => serveradmin from 127.0.0.1:15208
 [client_database_id] => 1
 [client_login_name] => serveradmin
 [client_unique_identifier] => serveradmin
 [client_origin_server_id] => 0
}
author Par0noid Solutions
access public

Returns

arrayclientinformation

addDebugLog

addDebugLog(string $text, string $methodName, string $line) : array

Adds an entry to debugLog

author Par0noid Solutions
access private

Parameters

$text

string

text which should added to debugLog

$methodName

string

name of the executed method [optional]

$line

string

line where error triggered [optional]

Returns

arraydebugLog

checkSelected throws out 2 errors

checkSelected() : array

Output:

Array
{
 [success] => false
 [errors] => Array
 [data] => false
}
author Par0noid Solutions
access private

Returns

arrayerror

escapeText

escapeText(string $text) : string

Escapes chars that we can use it in the query

author Par0noid Solutions
access private

Parameters

$text

string

text which should be escaped

Returns

stringtext

executeCommand

executeCommand(string $command, array $tracert) : mixed

Executes a command and fetches the response

author Par0noid Solutions
access private

Parameters

$command

string

command which should be executed

$tracert

array

array with information from first exec

Returns

mixeddata

ftRead

ftRead(int $size) : string

Reads data from ftHost

author Par0noid Solutions
access private

Parameters

$size

int

Returns

stringdata

ftSendData

ftSendData(mixed $data) : \none

Sends data to ftHost

author Par0noid Solutions
access private

Parameters

$data

mixed

Returns

\none

ftSendKey

ftSendKey(string $key, string $additional) : \none

Sends down/upload-key to ftHost

author Par0noid Solutions
access private

Parameters

$key

string

$additional

string

Returns

\none

generateOutput

generateOutput(boolean $success, array $errors, mixed $data) : array

Builds a method return as array

author Par0noid Solutions
access private

Parameters

$success

boolean

true/false

$errors

array

all errors which occured while executing a method

$data

mixed

parsed data from server

Returns

arrayoutput

getData

getData(string $mode, string $command) : mixed

Parses data from query and returns an array

author Par0noid Solutions
access private

Parameters

$mode

string

select return mode ('boolean', 'array', 'multi', 'plain')

$command

string

command which should be executed

Returns

mixeddata

isConnected

isConnected() : boolean

Checks if the connection is established

author Par0noid Solutions
access private

Returns

booleanconnected

quit closes the connection to host

quit() : \none
author Par0noid Solutions
access private

Returns

\none

splitBanIds

splitBanIds(string $text) : string

Splits banIds to array

author Par0noid Solutions
access private

Parameters

$text

string

plain text server response

Returns

stringtext

unEscapeText

unEscapeText(string $text) : string

Turns escaped chars to normals

author Par0noid Solutions
access private

Parameters

$text

string

text which should be escaped

Returns

stringtext

 Properties

 

$runtime 
author Par0noid Solutions
access private