<?php
$filepath = __FILE__;
include __DIR__.'/../header.php';

$online_users = shell_exec("online-users | head -n1 | awk '{print $3}'");
$total_users = shell_exec("members team | wc -w");
?>

<div class="row">
    <h1>users</h1>

    <p><a href="https://kiwi.tilde.chat/#team">
        <img src="https://tilde.chat/badges/badge.php?channel=%23team" alt="users online in #team">
    </a></p>
    <p><?=$online_users?> of <?=$total_users?> total users logged in</p>
    <p><em><a href="/tilde.24h.html"><i class="fa fa-clock-o"></i> recent updates</a></em></p>
</div>

<div class="row">
    <div class="col-md-5">
        <div class="list-group">
        <ul>
        <?php
        foreach (glob("/home/*") as $user):
            $user = basename($user); ?>
            <li style="list-style: none; margin-left: -40px;">
                <a href="/~<?=$user?>/" class="list-group-item">
                    <h6 class="list-group-item-heading">~<?=$user?></h6>
                </a>
            </li>
        <?php endforeach; ?>
        </ul>
        </div>
    </div>
</div>

<?php
include __DIR__.'/../footer.php';
