This repository was archived by the owner on Jul 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
383 lines (367 loc) · 13 KB
/
index.php
File metadata and controls
383 lines (367 loc) · 13 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<!DOCTYPE html>
<html>
<head>
<title>TS3 UserInterface</title>
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="comp/bt/bootstrap.css">
<link rel="stylesheet" type="text/css" href="comp/style.css"> <!-- for personal changes (not required) -->
<!-- JS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<!-- Custom Script -->
<script type="text/javascript" src="comp/script.js"></script>
</head>
<body>
<?php
// Libary
require_once('inc/TeamSpeak3.php');
// connect to server
require_once('inc/conn.php');
// list all clients
$all = $Vserver->clientList();
// list all channel
$allchannel = $Vserver->ChannelList();
?>
<div class="col-md-12" style="height: 100px;"></div>
<div class="col-md-2"></div>
<div class="col-md-8">
<h2 class="center">Spirit TS3 User Interface</h2>
<br>
<div class="col-md-6">
<div class="navibar">
<ul class="nav nav-pills" id="functionsnav">
<li><a href="#" data-target="#msg">Msg</a></li>
<li><a href="#" data-target="#kick">Kick</a></li>
<li><a href="#" data-target="#move">Move</a></li>
<li><a href="#" data-target="#ban">Ban</a></li>
<li><a href="#" data-target="#info">Info</a></li>
</ul>
</div>
<hr>
<div class="functions" id="functions">
<!-- MSG User -->
<div class="msg" id="msg">
<form method="post">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<select class="form-control" name="username">
<optgroup label="User">
<?php
echo '<option>Pick a User</option>';
// Print Users
foreach($all as $ts3_Client) {
if (strpos($ts3_Client, 'bot') == false) {
echo '<option value="'.$ts3_Client.'">'.$ts3_Client.'</option>';
}
}
echo '<optgroup label="Bot"></optgroup>';
foreach($all as $ts3_Client) {
if (strpos($ts3_Client, 'bot') == true) {
echo '<option value="'.$ts3_Client.'" disabled>'.$ts3_Client.'</option>';
}
}
?>
</select>
</div>
<br>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
<textarea type="text" class="form-control" name="message" placeholder="Message"></textarea>
</div>
<br>
<div class="fright" data-toggle="buttons">
<label class="btn btn-primary">
<input type="checkbox" name="poke" value="poke"> Poke a Client
</label>
</div>
<button type="submit" class="btn btn-primary"><i class="fa fa-paper-plane"></i> Send</button>
</div>
</form>
</div>
<hr>
<!-- Kick User -->
<div class="kick" id="kick">
<form method="post">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<select class="form-control" name="uname">
<optgroup label="User"></optgroup>
<?php
echo '<option>Pick a User</option>';
// Print Users
foreach($all as $ts3_Client) {
if (strpos($ts3_Client, 'bot') != true) {
echo '<option value="'.$ts3_Client.'">'.$ts3_Client.'</option>';
}
}
echo '<optgroup label="Bot"></optgroup>';
foreach($all as $ts3_Client) {
if (strpos($ts3_Client, 'bot') != false) {
echo '<option value="'.$ts3_Client.'" disabled>'.$ts3_Client.'</option>';
}
}
?>
</select>
</div>
<br>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
<input class="form-control" type="text" name="kickmsg" placeholder="Message">
</div>
<br>
<div class="fright" data-toggle="buttons">
<label class="btn btn-primary">
<input type="checkbox" name="reasonid" value="channelkick"> Kick Client from Channel
</label>
</div>
<button type="submit" class="btn btn-primary"><i class="fa fa-paper-plane"></i> Kick</button>
</div>
</form>
</div>
<hr>
<!-- Move User -->
<div class="move" id="move">
<form method="post">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<select class="form-control" name="mtarget">
<optgroup label="User"></optgroup>
<?php
echo '<option>Pick a User</option>';
// Print Users
foreach($all as $ts3_Client) {
if (strpos($ts3_Client, 'bot') != true) {
echo '<option value="'.$ts3_Client.'">'.$ts3_Client.'</option>';
}
}
echo '<optgroup label="Bot"></optgroup>';
foreach($all as $ts3_Client) {
if (strpos($ts3_Client, 'bot') != false) {
echo '<option value="'.$ts3_Client.'" disabled>'.$ts3_Client.'</option>';
}
}
?>
</select>
</div>
<br>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-bars"></i></span>
<select class="form-control" name="msolve">
<?php
echo '<option>Pick a Channel</option>';
// Print Users
foreach($allchannel as $ts3_Channel) {
echo '<option value="'.$ts3_Channel.'">'.$ts3_Channel.'</option>';
}
?>
</select>
</div>
<br>
<button type="submit" class="btn btn-primary"><i class="fa fa-paper-plane"></i> Move</button>
</div>
</form>
</div>
<hr>
<!-- Ban User -->
<div class="ban" id="ban">
<form method="post">
<div class="form-group">
<!-- Preset Selector -->
<div class="input-group">
<div class="btn-group" data-toggle="buttons" id="pre">
<label class="btn btn-primary active">
<input type="radio" name="preset" value="" id="self"> Type an own Message
</label>
<label class="btn btn-primary">
<input type="radio" name="preset" value="spam" id="spam"> Spam
</label>
<label class="btn btn-primary">
<input type="radio" name="preset" value="undis" id="undis"> undesirable
</label>
</div>
</div>
<br>
<!-- User Selector -->
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<select class="form-control" name="buser">
<optgroup label="User"></optgroup>
<?php
echo '<option>Pick a User</option>';
// Print Users
foreach($all as $ts3_Client) {
if (strpos($ts3_Client, 'bot') != true) {
echo '<option value="'.$ts3_Client.'">'.$ts3_Client.'</option>';
}
}
echo '<optgroup label="Bot"></optgroup>';
foreach($all as $ts3_Client) {
if (strpos($ts3_Client, 'bot') != false) {
echo '<option value="'.$ts3_Client.'" disabled>'.$ts3_Client.'</option>';
}
}
?>
</select>
</div>
<br>
<!-- Ban Msg Input -->
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
<input type="text" class="form-control" name="banmessage" placeholder="Message" id="banmsginput">
</div>
<br>
<div class="form-inline">
<!-- Time Value Selector -->
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-clock-o"></i></span>
<input class="form-control" type="number" name="bantimevalue" placeholder="Value" id="bantimevalue">
</div>
<!-- Sec | Min | Hour | Perm Selector -->
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-clock-o"></i></span>
<select class="form-control" name="bantime" id="bansel">
<option value="sec">Seconds</option>
<option value="min">Minutes</option>
<option value="hour">Hours</option>
<option value="day">Days</option>
<option value="perm">Permanent (10 years)</option>
</select>
</div>
</div>
<br>
<button type="submit" class="btn btn-primary"><i class="fa fa-paper-plane"></i> Ban</button>
</div>
</form>
</div>
<hr>
<!-- Information about User -->
<div class="info" id="info">
<form method="post">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<select class="form-control" name="infouser">
<optgroup label="User"></optgroup>
<?php
echo '<option>Pick a User</option>';
// Print Users
foreach($all as $ts3_Client) {
if (strpos($ts3_Client, 'bot') != true) {
echo '<option value="'.$ts3_Client.'">'.$ts3_Client.'</option>';
}
}
echo '<optgroup label="Bot"></optgroup>';
foreach($all as $ts3_Client) {
if (strpos($ts3_Client, 'bot') != false) {
echo '<option value="'.$ts3_Client.'" disabled>'.$ts3_Client.'</option>';
}
}
?>
</select>
</div>
<br>
<button type="submit" class="btn btn-primary"><i class="fa fa-paper-plane"></i> Info</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-6">
<?php
// Var for Msg
@$user = $_POST['username'];
@$msg = $_POST['message'];
@$choice = $_POST['poke'];
// Var for Kick
@$usern = $_POST['uname'];
@$kmsg = $_POST['kickmsg'];
@$reasid = $_POST['reasonid'];
// var for Move
@$muser = $_POST['mtarget'];
@$mziel = $_POST['msolve'];
// var for Info
@$iuser = $_POST['infouser'];
// var for Ban
@$banid = $_POST['preset'];
@$banuser = $_POST['buser'];
@$banmsg = $_POST['banmessage'];
@$btime = $_POST['bantime'];
@$btimevalue = $_POST['bantimevalue'];
// MSG User
if ($user != '') {
$ts3_Client = $Vserver->clientGetByName($user);
if ($choice == 'poke') {
$ts3_Client->poke($msg); // Pokes Clients
} else {
$ts3_Client->message($msg); // Write Privat Textmessages
}
}
// Kick User
if ($usern != '') {
$ts3_Client = $Vserver->clientGetByName($usern);
if ($reasid == 'channelkick') {
$rid = TeamSpeak3::KICK_CHANNEL;
} else {
$rid = TeamSpeak3::KICK_SERVER;
}
$Vserver->ClientKick($ts3_Client, $rid, $kmsg);
}
// Move User
if ($muser != '') {
$ts3_Client = $Vserver->clientGetByName($muser);
$ts3_Channel = $Vserver->channelGetByName($mziel);
$Vserver->clientMove($ts3_Client, $ts3_Channel);
}
// Ban
if ($banuser != '') {
switch ($btime){
case 'sec':
$btimeval = $btimevalue;
break;
case 'min':
$btimeval = $btimevalue * 60;
break;
case 'hour':
$btimeval = $btimevalue * 3600;
break;
case 'day':
$btimeval = $btimevalue * 86400;
break;
case 'perm':
$btimeval = 315360000;
break;
default:
$btimeval = NULL;
break;
}
$ts3_Client = $Vserver->clientGetByName($banuser);
$id = $ts3_Client->getId();
if ($banid == 'spam') {
$banmsg = 'Your wrote something unacceptable';
} elseif ($banid == 'undis') {
$banmsg = 'We don´t like you or We don´t want you on our ts';
}
$Vserver->clientBan($ts3_Client, $btimeval, $banmsg);
}
// Info User
if ($iuser != '') {
$ts3_Client = $Vserver->clientGetByName($iuser);
$info = $ts3_Client->getInfo();
echo '<div class="modal" style="display: block;" id="mod"><div class="modal-dialog modal-lg"><div class="modal-content"><div class="modal-header"><button type="button" class="close" id="close"><span>×</span></button><h4>Info for "'.$ts3_Client.'"</h4></div><div class="modal-body"><div class="ioutput">';
foreach ($info as $key => $value) {
echo $key.' - '.$value.'<br>';
}
echo '</div></div><div class="modal-footer"><a href="" class="btn btn-danger">Safe as TXT</a></div></div></div></div>';
}
// TS Viewer
// backup : echo $Vserver->getViewer(new TeamSpeak3_Viewer_Html("images/viewer/", "images/countryflags/", "data:image"));
echo $Vserver->getViewer(new TeamSpeak3_Viewer_Html("images/viewer/"));
?>
</div>
</div>
<div class="col-md-2"></div>
</body>
</html>