require_once ROOTDIR . "/include/database/class.ServerQueries.php";
require_once ROOTDIR . "/include/class.rcon.php";
// require_once(ROOTDIR."/include/objects/class.BannedUser.php");
$id = $_POST['id'];
$active = $_POST['active'];
// Switch the current active state to the other state
// off becomes on, and on becomes off
if ($active == 0) {
    $active = 1;
} else {
    $active = 0;
}
$banQueries = new BanQueries();
// Must be logged in to change the status
if ($member || $admin || $banManager || $fullPower) {
    $banQueries->updateBanActiveStatus($active, $id);
    if ($active == 0) {
        //$bannedUser = new BannedUser();
        $bannedUser = $banQueries->getBannedUser($id);
        unBanUser($bannedUser->getSteamId(), $bannedUser->getIp());
    }
}
function unBanUser($steamId, $bannedIP)
{
    // This will send an RCON command to the server
    $serverQueries = new ServerQueries();
    // Get the list of servers
    $servers = $serverQueries->getServers();
    // Cycle through each server
    foreach ($servers as $server) {
        $r = new rcon($server->getIp(), $server->getPort(), $server->getRcon());