sleep(1);
        /* if snort.sh crashed this will remove the pid */
        exec('/bin/rm /tmp/snort.sh.pid');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Cache-Control: no-store, no-cache, must-revalidate');
        header('Cache-Control: post-check=0, pre-check=0', false);
        header('Pragma: no-cache');
        header("Location: /snort/snort_interfaces.php");
        exit;
    }
}
if ($_POST["Submit2"]) {
    sync_snort_package_config();
    sleep(1);
    Running_Start($snort_uuid, $if_real, $id);
    header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    header('Cache-Control: no-store, no-cache, must-revalidate');
    header('Cache-Control: post-check=0, pre-check=0', false);
    header('Pragma: no-cache');
    header("Location: /snort/snort_interfaces_edit.php?id={$id}");
    exit;
}
$pgtitle = "Snort: Interface Edit: {$id} {$snort_uuid} {$if_real}";
include_once "head.inc";
?>

<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php 
include "fbegin.inc";
        $i++;
        exec("/usr/bin/logger -p daemon.info -i -t SnortBoot 'Snort Boot count...{$i}'");
        exec("/bin/echo {$i} > /tmp/snort_testing.sh.pid");
        // remove when finnished testing
        sleep(2);
    }
};
$snort_bootupWait();
$snort_bootupCleanStartStop = function ($type) use(&$_GET, &$g) {
    $snortstartArray = explode(',', $_GET[$type]);
    foreach ($snortstartArray as $iface_pre) {
        if (!empty($iface_pre)) {
            $iface = explode('_', $iface_pre);
            if (!empty($iface[0]) && !empty($iface[1]) && is_numeric($iface[2])) {
                if ($type === 'snortstart') {
                    Running_Start($iface[0], $iface[1], $iface[2]);
                }
                if ($type === 'snortstop') {
                    Running_Stop($iface[0], $iface[1], $iface[2]);
                }
            }
        }
    }
};
if (!empty($_GET[snortstart])) {
    $snort_bootupCleanStartStop('snortstart');
}
if (!empty($_GET[snortstop])) {
    $snort_bootupCleanStartStop('snortstop');
}
// important