AndryGabry
Member
- Dec 16, 2016
- 26
- 9
- 38
how can I check whether a user has a group server?
whit ts3framework
whit ts3framework
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;
}
try
{
$connect = "serverquery://".$USER_QUERY.":".$PASS_QUERY."@".$HOST_QUERY.":".$PORT_QUERY."";
$ts3 = TeamSpeak3::factory($connect);
$ts3 = $ts3->serverGetById(27);
$ts3->execute("clientupdate", array("client_nickname" => $NICK_QUERY));
}
catch(Exception $e) {
echo "[DEBUG] Ha ocurrido un error inesperado <br>";
echo "[DEBUG] Mensaje de error DEBUG: ".$e->getMessage()."<br>";
echo "[DEBUG] El codigo de error fue ".$e->getCode()."<br>";
if($e->getCode() == 0) {
echo "Error desconocido. Metodo invalido";
}
else if($e->getCode() == 10060){ echo "No se pudo conectar con el servidor de teamspeak 3";}
else if($e->getCode() == 520) { echo "Los datos de acceso query no son correctos";}
else if($e->getCode() == 3329){ echo "La conexion fue baneada por query. Intenta mas tarde";}
}
foreach ($ts3->clientList(array('client_type' => '0', 'connection_client_ip' => getClientIp())) as $client) {
$clientuid = $client->client_unique_identifier;
$cliente = $ts3->clientGetByUid($clientuid);
$nombrecliente = $cliente['client_nickname'];
$conectado = 1;
}
foreach(explode(",", $cliente["client_servergroups"]) as $sgid)
{
$groups[] = $sgid;
}
I dont understand this part. Why you take values from array and put into new array?foreach(explode(",", $cliente["client_servergroups"]) as $sgid) { $groups[] = $sgid; }
I dont understand this part. Why you take values from array and put into new array?
If you do explode on string with , delimeter you get a new array, so putting values into new array trough loop is pointless.
Change my mind.
explode(",", [/PHP ]
Groups now = 2,3,4,5,6,7,8
Idk what you want to say with this code, but you still are on same.PHP:explode(",", [/PHP ] Groups now = 2,3,4,5,6,7,8