Show Ban List From All Servers on Your Website

XARON

get over here!
Restricted
Joined
Nov 24, 2016
Messages
162
Reaction score
161
Points
118
So you can list ban list from all ports on your website. Tested on php7 w/ latest version unlicensed teamspeak 3 server (3.5.0). Just you need use ts3admin.class from here;

TS3Admin.class: https://github.com/par0noid/ts3admin.class

Code:
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
    <title>Document</title>
</head>
<body>
    <?php
    /**
     * Created by PhpStorm.
     * User: XARON
     * Date: 17.11.2018
     * Time: 19:04
     */
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
    define('MAIN', true);
    date_default_timezone_set('Europe/London');
    ini_set('default_charset', 'UTF-8');
    setlocale(LC_ALL, 'UTF-8');
    require_once('./ts3admin.class.php');

    $query = new ts3admin('127.0.0.1', 10011);
    if($query->getElement('success', $query->connect())) {
        $query->login('serveradmin', 'kU9dj+kw');
        $bans = array();
        foreach($query->serverList()['data'] as $k => $server) {
            $query->selectServer($server['virtualserver_port']);
            $query->setName(urlencode('Swallalala.'.rand(0, 1337)));
            array_push($bans, array('serverId' => $server['virtualserver_id'], 'serverName' => $server['virtualserver_name'], 'serverPort' => $server['virtualserver_port'], 'bans' => array()));
            foreach($query->getElement('data', $query->banList()) as $ban) {
                array_push($bans[$k]['bans'], array('banId' => (isset($ban['banid']) ? $ban['banid'] : null), 'ip' => (isset($ban['ip']) ? $ban['ip'] : null), 'name' => (isset($ban['name']) ? $ban['name'] : null), 'uid' => (isset($ban['uid']) ? $ban['uid'] : null), 'mytsid' => (isset($ban['mytsid']) ? $ban['mytsid'] : null), 'lastnickname' => (isset($ban['lastnickname']) ? $ban['lastnickname'] : null), 'created' => (isset($ban['created']) ? date('d.m.Y H:i:s a', $ban['created']) : null), 'duration' => (isset($ban['duration']) ? $ban['duration'] : null), 'invokername' => (isset($ban['invokername']) ? $ban['invokername'] : null), 'invokercldbid' => (isset($ban['invokercldbid']) ? $ban['lastnickname'] : null), 'invokeruid' => (isset($ban['invokeruid']) ? $ban['invokeruid'] : null), 'reason'  => (isset($ban['reason']) ? $ban['reason'] : null), 'enforcements' => (isset($ban['enforcements']) ? $ban['enforcements'] : null)));
            }
        }
    }
    ?>
    <?php
    foreach($bans as $ban) {
    ?>
        <h1 style="text-align: center !important;">Ban List From (#<?=$ban['serverId'].' - '.$ban['serverName'].' - '.$ban['serverPort']?>)</h1>
        <table class="table">
            <thead class="thead-dark">
            <tr>
                <th scope="col" style="text-align: center !important;">ID</th>
                <th scope="col" style="text-align: center !important;">IP</th>
                <th scope="col" style="text-align: center !important;">Name</th>
                <th scope="col" style="text-align: center !important;">Duration</th>
                <th scope="col" style="text-align: center !important;">Invoker</th>
                <th scope="col" style="text-align: center !important;">Reason</th>
            </tr>
            </thead>
            <tbody>
            <?php foreach($ban['bans'] as $user) { ?>
                <tr>
                    <th scope="row" style="text-align: center !important;"><?=($user['banId'] ? $user['banId'] : '-')?></th>
                    <th scope="row" style="text-align: center !important;"><?=($user['ip'] ? $user['ip'] : '-')?></th>
                    <th scope="row" style="text-align: center !important;"><?=($user['lastnickname'] ? $user['lastnickname'] : '-')?></th>
                    <th scope="row" style="text-align: center !important;"><?=($user['duration'] ? $user['duration'] : '-')?></th>
                    <th scope="row" style="text-align: center !important;"><?=($user['invokername'] ? $user['invokername'] : '-')?></th>
                    <th scope="row" style="text-align: center !important;"><?=($user['reason'] ? $user['reason'] : 'No Reason')?></th>
                </tr>
            <?php } ?>
            </tbody>
        </table>
    <?php } ?>
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</body>
</html>
 

B0STANLI

BrownStarTeam
Joined
Oct 20, 2015
Messages
11
Reaction score
17
Points
38
Of course, a person may need this project. Your hands are magic, brother.
 
Top