}
/* start/stop snort */
if ($_POST['toggle'] && is_numericint($_POST['id'])) {
    $snortcfg = $config['installedpackages']['snortglobal']['rule'][$_POST['id']];
    $if_real = get_real_interface($snortcfg['interface']);
    $if_friendly = convert_friendly_interface_to_friendly_descr($snortcfg['interface']);
    if (snort_is_running($snortcfg['uuid'], $if_real)) {
        log_error("Toggle (snort stopping) for {$if_friendly}({$snortcfg['descr']})...");
        snort_stop($snortcfg, $if_real);
    } else {
        log_error("Toggle (snort starting) for {$if_friendly}({$snortcfg['descr']})...");
        /* set flag to rebuild interface rules before starting Snort */
        $rebuild_rules = true;
        sync_snort_package_config();
        $rebuild_rules = false;
        snort_start($snortcfg, $if_real);
    }
    sleep(3);
    // So the GUI reports correctly
}
$pgtitle = "Services: {$snort_package_version}";
include_once "head.inc";
?>
<body link="#000000" vlink="#000000" alink="#000000">

<?php 
include_once "fbegin.inc";
/* Display Alert message */
if ($input_errors) {
    print_input_errors($input_errors);
}
         $natent['stream5_tcp_engine']['item'] = array();
     }
     $natent['stream5_tcp_engine']['item'][] = $stream5_eng;
     $a_rule[] = $natent;
 }
 /* If Snort is disabled on this interface, stop any running instance */
 if ($natent['enable'] != 'on') {
     snort_stop($natent, $if_real);
 }
 /* Save configuration changes */
 write_config("Snort pkg: modified interface configuration for {$natent['interface']}.");
 /* Update snort.conf and snort.sh files for this interface */
 sync_snort_package_config();
 /* See if we need to restart Snort after an interface re-assignment */
 if ($snort_start == true) {
     snort_start($natent, $if_real);
 }
 /*******************************************************/
 /* Signal Snort to reload configuration if we changed  */
 /* HOME_NET, EXTERNAL_NET or Suppress list values.     */
 /* The function only signals a running Snort instance  */
 /* to safely reload these parameters.                  */
 /*******************************************************/
 if ($snort_reload == true) {
     snort_reload_config($natent, "SIGHUP");
 }
 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');