freets3.ovh
Active Member
- Sep 19, 2015
- 150
- 105
- 85
Small php script to display the list of banned users on your TeamSpeak server, on your site.
============================================================
PHP:
<?php
require_once("libraries/TeamSpeak3/TeamSpeak3.php");
$ts3 = TeamSpeak3::factory("serverquery://user:[email protected]:xxxx/?server_port=yyyy");
$banlist = $ts3 -> banlist();
echo '<table class="table table-striped table-bordered table-hover" border="1">';
echo '
<tr>
<th>Ban ID</th>
<th>Ban IP</th>
<th>Ban Name</th>
<th>Ban Duration</th>
<th>Banned By</th>
<th>Ban reason</th>
</tr>';
foreach ($banlist as $row)
{
if(empty($row['reason']))
$reason = "No raison given";
else
$reason = $row['reason'];
if(empty($row['name']))
$name = "No name given";
else
$name = $row['name'];
if(empty($row['ip']))
$ip = "No IP given";
else
$ip = $row['ip'];
if($row['duration'] == 0)
$expires = "Ban permanent";
else
$expires = date('d-m-Y H:i:s', $row['created'] + $row['duration']);
echo '<td>' . $row['banid'] . '</td>';
echo '<td>' . $ip . '</td>';
echo '<td>' . $name . '</td>';
echo '<td>' . $expires . '</td>';
echo '<td>' . $row['invokername'] . '</td>';
echo '<td>' . $reason . '</td>';
echo '</tr>';
}
?>