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

Discussion in 'Server' started by ServerOfManyKEKs, Jan 11, 2017.

  1. ServerOfManyKEKs

    ServerOfManyKEKs New Member

    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: Jan 11, 2017
  2. Ridicc

    Ridicc Moderator

    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?
  3. SpeciaL

    SpeciaL Contributor

    I think he's type: TS3 API Framework.
    he mean ts3 php framework.
  4. SpeciaL

    SpeciaL Contributor

    I think this will help you:
    TeamSpeak3::factory("serverquery://serveradmin:[email protected]: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: Jan 11, 2017
  5. ServerOfManyKEKs

    ServerOfManyKEKs New Member

    I am using the Teamspeak PHP API from Teamspeak. That'd be great.

    Yes thanks very much I'll play around with what you've shown me here, cheers!
    Last edited by a moderator: Jan 11, 2017

Share This Page