<?php

// CBA to explain; somewhat self-explanatory

require 'class.teamspeak.php';

try
{
    
$ts = new ts_interface('ip'101);
    
?>
    <table>
    <tr>
     <th>Name</th>
     <th>IP</th>
     <th>Permissions</th>
     <th>Packet Loss</th>
    </tr>
    <?php

    
foreach($ts->getusers() as $user => $detail)
    {
        if(
$detail['ip'] == '"0.0.0.0"'$detail['ip'] = 'Unknown';
        
        
$privs .= ($detail['cprivs'] == 1) ? 'CA ' '';
        
$privs .= ($detail['cprivs'] == 2) ? 'O ' '';
        
$privs .= ($detail['cprivs'] == 4) ? 'V ' '';
        
$privs .= ($detail['cprivs'] == 8) ? 'AO ' '';
        
$privs .= ($detail['cprivs'] == 16) ? 'AV ' '';

        
$privs .= ($detail['pprivs'] == 1) ? 'SA ' '';
        
$privs .= ($detail['pprivs'] == 4) ? 'R ' '';
        
$privs .= ($detail['pprivs'] == 5) ? 'R SA ' '';
        if(empty(
$privs)) $privs 'Unregistered';

        echo 
'<tr><td>'$detail['nick'], '</td><td>'$detail['ip'], '</td><td>'$privs'</td><td>'$detail['pl'], '</td></tr>';
        unset(
$privs);
    }

    
?>
    </table>
    <?php
}
catch(
Exception $e)
{
    echo 
'<p style="color: #c00;">'$e->getMessage(), '</p>';
}

?>