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 pathclientkick.php
More file actions
62 lines (52 loc) · 1.49 KB
/
clientkick.php
File metadata and controls
62 lines (52 loc) · 1.49 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
62
<?PHP
/**
* clientkick.php
*
* Is a small script to demonstrate how to kick a client 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);
#check if id parameter is set
if(isset($_GET['id']) and !empty($_GET['id']) and ctype_digit($_GET['id'])) {
#kick player from server
if(!$tsAdmin->clientKick($_GET['id'], 'server')) {
#show error if client kick was failed
echo '<script>alert(\'Client not found\')</script>';
}
}
#get clientlist
$clients = $tsAdmin->clientList();
#print client count
echo count($clients['data']) . ' clients on selected server<br><br>';
#print clients to browser
foreach($clients['data'] as $client) {
echo '<a href="clientkick.php?id='.$client['clid'].'">'.$client['client_nickname'].'</a><br>';
}
}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>';
}
}
?>