This repository was archived by the owner on Oct 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathclientlist_with_avatar.php
More file actions
61 lines (51 loc) · 1.4 KB
/
clientlist_with_avatar.php
File metadata and controls
61 lines (51 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?PHP
/**
* clientlist.php
*
* Is a small script to demonstrate how to get a clientlist via ts3admin.class
*
* by par0noid solutions - ts3admin.info
*
*/
/*-------SETTINGS-------*/
$ts3_ip = '127.0.0.1';
$ts3_queryport = 10011;
$ts3_user = 'serveradmin';
$ts3_pass = 'password';
$ts3_port = 9987;
/*----------------------*/
#Include ts3admin.class.php
require("../lib/ts3admin.class.php");
#build a new ts3admin object
$tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);
#login as serveradmin
if($tsAdmin->getElement('success', $tsAdmin->connect($ts3_user, $ts3_pass))) {
#select teamspeakserver
$tsAdmin->selectServer($ts3_port);
#get clientlist
$clients = $tsAdmin->clientList("-uid");
echo '<table border="1">';
#print clients to browser
foreach($clients['data'] as $client) {
if($client['client_type'] == '0'){
$avatar = $tsAdmin->clientAvatar($client['client_unique_identifier']);
if($avatar["success"]) {
echo '<tr><td><img src="data:image/png;base64,'.$avatar["data"].'" /></td><td>'.$client['client_nickname'].'</tr>';
}else{
echo '<tr><td>X</td><td>'.$client['client_nickname'].'</tr>';
}
}
}
echo '</table>';
}else{
echo 'Connection could not be established.';
}
/**
* This code retuns all errors from the debugLog
*/
if(count($tsAdmin->getDebugLog()) > 0) {
foreach($tsAdmin->getDebugLog() as $logEntry) {
echo '<script>alert("'.$logEntry.'");</script>';
}
}
?>