How to see if a client is in a specific server group (TS3 SRV QUERY)

Jul 22, 2016
2
0
35
Hey guys,

FYI: I'm an amateur PHP coder and have only recently taken up learning it with the TS3 PHP Framework.

I'm currently trying to find of a way to check if a user is in a specified Server group. I have looked up the "SERVERGROUPSBYCLIENTID" server query command but I'm not entirely sure how I'd use this value as a variable. I've tried using foreach but I've had no luck. Besides its a pretty inconvenient way just to see if a user is in a server group.

I want to achieve something like this. I can limit who can access a web page based on server groups from teamspeak.: If user is in group ## {include(...)} else {die(...)}

Any help or guidance would be greatly appreciated. Thanks in advance.
 
Last edited:

Norvik

Retired Staff
Contributor
Jul 18, 2015
635
588
157
Loop through all clients and compare their IP with the one that's accessing the PHP script. If you found the client there should be an array containing the clients servergroups so just loop through that one and check if your groupid is in there. I can post an example when I'm at home if my explanation didn't help you. Which framework are you using?
 

FarisDev

L oryh brx
Contributor
Jun 9, 2016
277
111
107
Loop through all clients and compare their IP with the one that's accessing the PHP script. If you found the client there should be an array containing the clients servergroups so just loop through that one and check if your groupid is in there. I can post an example when I'm at home if my explanation didn't help you. Which framework are you using?
I think he's type: TS3 API Framework.
he mean ts3 php framework.
 

FarisDev

L oryh brx
Contributor
Jun 9, 2016
277
111
107
I think this will help you:
PHP:
<?php
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://serveradmin:11@1:10011/?server_port=9987&blocking=0&nickname=$botname");
$sgcid = explode(",", $ts3_client["client_servergroups"]);
//18 user dbid
    if (in_array(18 ,$sgcid)){
//Type what do you want.
echo 'TEST';
}
but try to make foreach ts3_virutal server list etc.. I do not have time to make it for you,,,
 
Last edited:
Jul 22, 2016
2
0
35
Loop through all clients and compare their IP with the one that's accessing the PHP script. If you found the client there should be an array containing the clients servergroups so just loop through that one and check if your groupid is in there. I can post an example when I'm at home if my explanation didn't help you. Which framework are you using?
I am using the Teamspeak PHP API from Teamspeak. That'd be great.

I think this will help you:
PHP:
<?php
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://serveradmin:11@1:10011/?server_port=9987&blocking=0&nickname=$botname");
$sgcid = explode(",", $ts3_client["client_servergroups"]);
//18 user dbid
    if (in_array(18 ,$sgcid)){
//Type what do you want.
echo 'TEST';
}
but try to make foreach ts3_virutal server list etc.. I do not have time to make it for you,,,
Yes thanks very much I'll play around with what you've shown me here, cheers!
 
Last edited by a moderator:
Top