if ($_POST['enable'] && !($_POST['guest'] || $_POST['local'])) {
        $input_errors[] = gettext("You must select at least one authentication method.");
    }
    if (!$input_errors) {
        $config['afp']['enable'] = $_POST['enable'] ? true : false;
        $config['afp']['afpname'] = $_POST['afpname'];
        $config['afp']['guest'] = $_POST['guest'] ? true : false;
        $config['afp']['local'] = $_POST['local'] ? true : false;
        $config['afp']['noddp'] = $_POST['noddp'] ? true : false;
        write_config();
        $retval = 0;
        if (!file_exists($d_sysrebootreqd_path)) {
            config_lock();
            $retval |= rc_update_service("afpd");
            $retval |= rc_update_service("mdnsresponder");
            config_unlock();
        }
        $savemsg = get_std_save_message($retval);
    }
}
include "fbegin.inc";
?>
<script type="text/javascript">
<!--
function enable_change(enable_change) {
	var endis = !(document.iform.enable.checked || enable_change);
	document.iform.afpname.disabled = endis;
	document.iform.guest.disabled = endis;
	document.iform.local.disabled = endis;
	document.iform.noddp.disabled = endis;
}
function delete_from_whitelist($srcip)
{
    config_lock();
    $whitelist = split("\n", file_get_contents("/var/db/whitelist.txt"));
    $fd = fopen("/var/db/whitelist.txt", "w");
    foreach ($whitelist as $wl) {
        if ($wl != "") {
            if (!stristr($wl, $srcip)) {
                fwrite($fd, "{$wl}\n");
            }
        }
    }
    fclose($fd);
    mwexec("/sbin/pfctl -q -t spamd -T delete {$srcip}");
    mwexec("/sbin/pfctl -q -t whitelist -T replace -f /var/db/whitelist.txt");
    config_unlock();
}