Question I have a Question !♥

Joined
Mar 20, 2016
Messages
39
Points
43
Location
in The World :)
Hello everyone, I am a small programmer in PHP
I want to help everyone that it is extracted UUID + CLIENT NAME from IP
How ? How?

Sorry But my language the english is bad xD
♥ Thank You ♥
 

timodohmen

Member
Joined
Oct 16, 2015
Messages
125
Points
63
Age
29
Hello everyone, I am a small programmer in PHP
I want to help everyone that it is extracted UUID + CLIENT NAME from IP
How ? How?
Sorry But my language the english is bad xD
♥ Thank You ♥
I think you ask how you can find out the Client name and UID from the users ÌP Rigth?
 

timodohmen

Member
Joined
Oct 16, 2015
Messages
125
Points
63
Age
29
Dude we doesn't understand want you want from us ? ahhh men....
 

Alligatoras

Administrator
Joined
Mar 31, 2016
Messages
2,047
Points
341
Age
26
Location
Greece
You mean to recognize client automatically, without put UUID or nickname
What he actually needs it to add to his website a box that says: Welcome (TeamspeakUser) and the Teamspeak User will be changed with the user's name based his IP Address!
 

Patrick

Member
Joined
Jun 8, 2016
Messages
4
Points
35
PHP:
$user = 'serveradmin';
$password = '12345';
$ip_query = '127.0.0.1';
$port = '9987';

try {
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://$user:[email protected]$ip_query/?server_port=$port&nickname=GetNameByIP");

foreach ($ts3_VirtualServer->clientList() as $cl) {
                if ($cl->client_type) continue;
                if ($cl->getProperty('connection_client_ip') == $_SERVER['REMOTE_ADDR']) {
                        $result[] = $cl->client_nickname;
                        $uid = $cl->client_unique_identifier;
                }
        }
}
catch (Exception $e) {
        echo "<p class='error'><b>Error " . $e->getCode() . ":</b> " . $e->getMessage() . "</p>";
        die;
}


if ($result == "" ) {
exit;
}

echo "Welcome To Our Server" . implode(', ', $result) . "<br>";
echo "Your ID: " . $uid;
 
Last edited by a moderator:

Najsr

Moderator
Developer
Joined
Apr 23, 2016
Messages
425
Points
107
Location
void
Here ya go:
PHP:
require_once("libraries/TeamSpeak3/TeamSpeak3.php");
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://USERNAME:[email protected]:10011/?server_port=9987");
$clientip = $_SERVER['REMOTE_ADDR'];
$nickname = array();
$uid = array();
foreach($ts3_VirtualServer->clientListDb() as $Client)
{
    if($Client['client_lastip'] == $clientip)
    {
        $nickname[] = $Client['client_nickname'];
        $uid[] = $Client['client_unique_identifier'];
    }
 

}

if($nickname[0] == "") { $nickname[0] = "New member"; $uid[0] = "New meber"; }

echo "Name: " . $nickname[0];
echo "<br/>";
echo "UID: " . $uid[0];
It prints first connected client with that ip.
 
Last edited:
Joined
Mar 20, 2016
Messages
39
Points
43
Location
in The World :)
Here ya go:
PHP:
require_once("libraries/TeamSpeak3/TeamSpeak3.php");
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://USERNAME:[email protected]:10011/?server_port=9987");
$clientip = $_SERVER['REMOTE_ADDR'];
$nickname = array();
$uid = array();
foreach($ts3_VirtualServer->clientListDb() as $Client)
{
    if($Client['client_lastip'] == $clientip)
    {
        $nickname[] = $Client['client_nickname'];
        $uid[] = $Client['client_unique_identifier'];
    }
  

}

echo "Name: " . $nickname[0];
echo "<br/>";
echo "UID: " . $uid[0];
It prints first connected client with that ip.
Tell me

Notice: Undefined offset: 0 in D:\My-Servers\xampp\htdocs\SkyLayerBots\inc\source.php on line 21
Name:

Notice: Undefined offset: 0 in D:\My-Servers\xampp\htdocs\SkyLayerBots\inc\source.php on line 23
UID:
 

Najsr

Moderator
Developer
Joined
Apr 23, 2016
Messages
425
Points
107
Location
void
That means nobody matches the ip.

EDIT: Slightly edited the script (if nobody matches with any ip, it will print New member)
 
Last edited:

Najsr

Moderator
Developer
Joined
Apr 23, 2016
Messages
425
Points
107
Location
void
I'll take a look at it tomorrow.

EDIT: Still didn't figure hw to do it :D
 
Last edited:

EscuderoKevin

Active Member
Joined
Jul 2, 2015
Messages
377
Points
90
Age
26
Location
Argentina
Hello everyone, I am a small programmer in PHP
I want to help everyone that it is extracted UUID + CLIENT NAME from IP
How ? How?
Sorry But my language the english is bad xD
♥ Thank You ♥

Get IP.
PHP:
    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;
    }
Get UID:
PHP:
    $connect = "serverquery://".$USER_QUERY.":".$PASS_QUERY."@".$HOST_QUERY.":".$PORT_QUERY."/?server_port=".$SERVER_PORT."";
    $ts3 = TeamSpeak3::factory($connect);
    $FLAG = false;
   
    foreach ($ts3->clientList(array('client_type' => '0', 'connection_client_ip' => getClientIp())) as $client) {
        $clientuid = $client->client_unique_identifier;
        $client_nickname = $client->client_nickname;
        $client_clid = $client->clid;
        $FLAG = true;
        break;
    }
    if (!$FLAG){
        echo "<p><b>You are not conected To TS3 SErver.</b></p><br/>";
        header("refresh: 10; url = ./");
        die; 
    }
 
Joined
Mar 20, 2016
Messages
39
Points
43
Location
in The World :)
Get IP.
PHP:
    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;
    }
Get UID:
PHP:
    $connect = "serverquery://".$USER_QUERY.":".$PASS_QUERY."@".$HOST_QUERY.":".$PORT_QUERY."/?server_port=".$SERVER_PORT."";
    $ts3 = TeamSpeak3::factory($connect);
    $FLAG = false;
  
    foreach ($ts3->clientList(array('client_type' => '0', 'connection_client_ip' => getClientIp())) as $client) {
        $clientuid = $client->client_unique_identifier;
        $client_nickname = $client->client_nickname;
        $client_clid = $client->clid;
        $FLAG = true;
        break;
    }
    if (!$FLAG){
        echo "<p><b>You are not conected To TS3 SErver.</b></p><br/>";
        header("refresh: 10; url = ./");
        die;
    }
thank you ♥
 

Top