Hello,
I've been looking and searching but haven't been able to find a method to fetch that information for a client in my server. Could someone point me in the right direction? Thanks.
We are migrating towards a new forum system located at community.teamspeak.com, as such this forum will become read-only on January 29, 2020
Hello,
I've been looking and searching but haven't been able to find a method to fetch that information for a client in my server. Could someone point me in the right direction? Thanks.
I found a solution!
$var will contain the following keys (for future reference and SEO):Code:$client = $this->ts3->clientGetByUid($uid); $var = $client->getInfo(); var_dump($var);
clid, cid, client_database_id, client_nickname, client_type, client_away, client_away_message, client_flag_talking, client_input_muted, client_output_muted, client_input_hardware, client_output_hardware, client_talk_power, client_is_talker, client_is_priority_speaker, client_is_recording, client_is_channel_commander, client_unique_identifier, client_servergroups, client_channel_group_id, client_channel_group_inherited_channel_id, client_version, client_platform, client_idle_time, client_created, client_lastconnected, client_icon_id, client_country, connection_client_ip, client_badges, client_outputonly_muted, client_default_channel, client_meta_data, client_version_sign, client_security_hash, client_login_name, client_totalconnections, client_flag_avatar, client_talk_request, client_talk_request_msg, client_description, client_month_bytes_uploaded, client_month_bytes_downloaded, client_total_bytes_uploaded, client_total_bytes_downloaded, client_nickname_phonetic, client_needed_serverquery_view_power, client_default_token, client_myteamspeak_id, client_integrations, client_base64HashClientUID, connection_filetransfer_bandwidth_sent, connection_filetransfer_bandwidth_received, connection_packets_sent_total, connection_bytes_sent_total, connection_packets_received_total, connection_bytes_received_total, connection_bandwidth_sent_last_second_total, connection_bandwidth_sent_last_minute_total, connection_bandwidth_received_last_second_total, connection_bandwidth_received_last_minute_total, connection_connected_time
Hello,
the output can be used to display the whole thing like this:
I myself wrote this in the direction of a profile viewCode:// load framework files require_once('ts3_lib/TeamSpeak3.php'); // connect to local server, authenticate and spawn an object for the virtual server on port 9987 $ts3_VirtualServer = TeamSpeak3::factory("serverquery://serveradmin:[email protected]:10011/?server_port=9987"); $uid = "xyz"; $client = $ts3_VirtualServer->clientGetByUid($uid); $var = $client->getInfo(); echo 'The Database ID is '.$var['client_database_id']; // Database ID echo 'User '.$var['client_nickname'].' comes from '.$var['client_country']; // Nickname with Country short (EN) echo 'The User has visited the TS '.$var['client_totalconnections'].' times'; // totalconnections echo 'Last Connected: '.$var['client_lastconnected'].PHP_EOL; // Unix timestamp for last connected time. echo 'Last Connected Date: '.date('Y/m/d', $var['client_lastconnected']).PHP_EOL; // For a date, use PHP native date($format, $time) echo 'Last nickname: '.$var['client_nickname']; // Last known nickname
maybe this helps a little with the calculation of the upload and downloadCode:include BASEDIR."ts3framework/libraries/TeamSpeak3/TeamSpeak3.php"; require_once BASEDIR."ts3framework/config.php"; $host_profile = "xxx.xxx.xxx.xxx"; $query_profile = "10011"; $serverport_profile = "xxxx"; $ts3_VirtualServer_profile = TeamSpeak3::factory("serverquery://".$serverquery_username.":".$serverquery_pass."@".$host_profile.":".$query_profile."/?server_port=".$serverport_profile.""); $uid_profile = $user_data['user_ts3register']; $client_profile = $ts3_VirtualServer_profile->clientFindDb($uid_profile, true); $info_profile = $ts3_VirtualServer_profile->clientinfoDb($client_profile); try { if (iADMIN) { echo "<td class='col-md-3 control-label text-left'>UID</td>\n"; echo "<td class='col-md-6 text-right'>".$info_profile['client_unique_identifier']."</td>\n"; echo "<tr>\n"; echo "<td class='col-md-3 control-label text-left'>Database ID</td>\n"; echo "<td class='col-md-6 text-right'>".$info_profile['client_database_id']."</td>\n"; echo "<tr>\n"; echo "<td class='col-md-3 control-label text-left'>last IP</td>\n"; echo "<td class='col-md-6 text-right'>".$info_profile['client_lastip']."</td>\n"; echo "<tr>\n"; } else { echo "<td class='col-md-3 control-label text-left'>UID</td>\n"; echo "<td class='col-md-6 text-right'>Only visible to administrators</td>\n"; echo "<tr>\n"; echo "<td class='col-md-3 control-label text-left'>Database ID</td>\n"; echo "<td class='col-md-6 text-right'>Only visible to administrators</td>\n"; echo "<tr>\n"; echo "<td class='col-md-3 control-label text-left'>last IP</td>\n"; echo "<td class='col-md-6 text-right'>Only visible to administrators</td>\n"; echo "<tr>\n"; } echo "<td class='col-md-3 control-label text-left'>Logins</td>\n"; echo "<td class='col-md-6 text-right'>".$info_profile['client_totalconnections']."</td>\n"; echo "<tr>\n"; echo "<td class='col-md-3 control-label text-left'>Last Connected Date</td>\n"; echo "<td class='col-md-6 text-right'>".date('d.m.Y H:i:s', $info_profile['client_lastconnected'])."</td>\n"; echo "<tr>\n"; echo "<td class='col-md-3 control-label text-left'>Traffic Upload</td>\n"; echo "<td class='col-md-6 text-right'>".TeamSpeak3_Helper_Convert::bytes($info_profile['client_total_bytes_uploaded'])."</td>\n"; echo "<tr>\n"; echo "<td class='col-md-3 control-label text-left'>Traffic Download</td>\n"; echo "<td class='col-md-6 text-right'>".TeamSpeak3_Helper_Convert::bytes($info_profile['client_total_bytes_downloaded'])."</td>\n"; echo "<tr>\n"; echo "<td class='col-md-3 control-label text-left'>Traffic Total</td>\n"; echo "<td class='col-md-6 text-right'>".TeamSpeak3_Helper_Convert::bytes($info_profile['client_total_bytes_uploaded'] + $info_profile['client_total_bytes_downloaded'])."</td>\n"; } catch(Exception $e) { echo "<td class='col-md-3 control-label text-left'>Server</td>\n"; echo "<td class='col-md-6 text-right'>Restart</td>\n"; echo "<tr>\n"; echo "<td class='col-md-3 control-label text-left'>Server</td>\n"; echo "<td class='col-md-6 text-right'>Maintenance</td>\n"; echo "<tr>\n"; echo "<td class='col-md-3 control-label text-left'>Server</td>\n"; echo "<td class='col-md-6 text-right'>Offline</td>\n"; }
There are currently 1 users browsing this thread. (0 members and 1 guests)