Set your Client-Description through PHP (is there a bug within the script?)

h1web

VIP
Sep 2, 2015
206
134
131
hey guys,

i have a PHP script which allows you to set your client description through a website (php),
however, some clients get the message "please connect to our TS to set your description first" (which is the error message when you are not connected) EVEN if they are connected to the server.
the script is working for me, maybe it happens when you have a "/" in your UID?

I release the source, maybe you guys have a idea why its not working sometimes.

index.php - pastebin.com/raw/rH3ZNmiy
update_battletag.php - pastebin.com/raw/TBaycK6k
 

pwn3r

Member
Jan 1, 2018
143
63
64
why do you check clientListDb() for client_lastip instead of checking clientList() for current connection_client_ip?
 

h1web

VIP
Sep 2, 2015
206
134
131
why do you check clientListDb() for client_lastip instead of checking clientList() for current connection_client_ip?

Getting a 500 error when replacing the clientListDb() and client_lastip with clientList() and connection_client_ip

@EscuderoKevin - i also get a 500 error with your script ^^

PHP Fatal error: Cannot use try without catch or finally
 
Last edited:

EscuderoKevin

Well-Known Member
Jul 2, 2015
380
181
130
Change lines 53 to 107 whit this.

try
{
$connect = "serverquery://".$USER_QUERY.":".$PASS_QUERY."@".$HOST_QUERY.":".$PORT_QUERY."/?server_port=".$SERVER_PORT."";
$ts3 = TeamSpeak3::factory($connect);
$ts3->execute("clientupdate", array("client_nickname" => $NICK_QUERY));
}

catch(Exception $e) {

echo "[DEBUG] Error Message: ".$e->getMessage()."<br>";
echo "[DEBUG] Error Code ".$e->getCode()."<br>";

}

and in down add this:

foreach ($ts3->clientList(array('client_type' => '0', 'connection_client_ip' => getClientIp())) as $client) {
$clientuid = $client->client_unique_identifier;
$clienta = $ts3->clientGetByUid($clientuid);
$nombrecliente = $clienta['client_nickname'];
$conectado = 1;
break;
}
 

pwn3r

Member
Jan 1, 2018
143
63
64
Getting a 500 error when replacing the clientListDb() and client_lastip with clientList() and connection_client_ip

@EscuderoKevin - i also get a 500 error with your script ^^

PHP Fatal error: Cannot use try without catch or finally
You can't just copy paste the code and expect it to work, you should know what you are doing. If you get 500 HTTP Error then check the logs and try to fix your problem by yourself!
 

h1web

VIP
Sep 2, 2015
206
134
131
Change lines 53 to 107 whit this.

try
{
$connect = "serverquery://".$USER_QUERY.":".$PASS_QUERY."@".$HOST_QUERY.":".$PORT_QUERY."/?server_port=".$SERVER_PORT."";
$ts3 = TeamSpeak3::factory($connect);
$ts3->execute("clientupdate", array("client_nickname" => $NICK_QUERY));
}

catch(Exception $e) {

echo "[DEBUG] Error Message: ".$e->getMessage()."<br>";
echo "[DEBUG] Error Code ".$e->getCode()."<br>";

}

and in down add this:

foreach ($ts3->clientList(array('client_type' => '0', 'connection_client_ip' => getClientIp())) as $client) {
$clientuid = $client->client_unique_identifier;
$clienta = $ts3->clientGetByUid($clientuid);
$nombrecliente = $clienta['client_nickname'];
$conectado = 1;
break;
}

Its working =D <3
 
Top