$countErrors++;
            $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You selected an invalid category order. (category)<br>";
        } else {
            $intNewOrderSpot = 1;
        }
    } else {
        if ($_POST['beforeafter'] != "before" and $_POST['beforeafter'] != "after") {
            $countErrors++;
            $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You selected an invalid category order. (before/after)<br>";
        } else {
            $intNewOrderSpot = $downloadCatObj->makeRoom($_POST['beforeafter']);
        }
    }
    if ($countErrors == 0) {
        $accessKey = $_POST['accesskey'] != 1 ? 0 : 1;
        if ($downloadCatObj->addNew(array("name", "ordernum", "accesstype"), array($_POST['catname'], $intNewOrderSpot, $accessKey))) {
            $downloadCatInfo = $downloadCatObj->get_info_filtered();
            foreach ($arrExtensions as $strExtension) {
                $downloadExtObj->addNew(array("downloadcategory_id", "extension"), array($downloadCatInfo['downloadcategory_id'], trim($strExtension)));
            }
            echo "\n\t\t\t<div style='display: none' id='successBox'>\n\t\t\t\t<p align='center'>\n\t\t\t\t\tSuccessfully Added New Download Category: <b>" . $downloadCatInfo['name'] . "</b>!\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t\t\n\t\t\t<script type='text/javascript'>\n\t\t\t\tpopupDialog('Add New Download Category', '" . $MAIN_ROOT . "members', 'successBox');\n\t\t\t</script>\n\t\t\t";
        }
    } else {
        $_POST = filterArray($_POST);
        $_POST['submit'] = false;
    }
}
if (!$_POST['submit']) {
    $countCategories = 0;
    $result = $mysqli->query("SELECT * FROM " . $dbprefix . "downloadcategory ORDER BY ordernum DESC");
    while ($row = $result->fetch_assoc()) {