0) { ob_start(); //important or other posts will fail $save_date = exec('/bin/date "+%Y-%m-%d-%H-%M-%S"'); $file_name = "snort_blocked_{$save_date}.tar.gz"; exec('/bin/mkdir -p /tmp/snort_blocked'); file_put_contents("/tmp/snort_blocked/snort_block.pf", ""); foreach($blocked_ips_array_save as $counter => $fileline) { if (empty($fileline)) continue; $fileline = trim($fileline, " \n\t"); file_put_contents("/tmp/snort_blocked/snort_block.pf", "{$fileline}\n", FILE_APPEND); } exec("/usr/bin/tar cf /tmp/{$file_name} /tmp/snort_blocked"); if(file_exists("/tmp/{$file_name}")) { header("Expires: Mon, 26 Jul 1997 05:00:00 GMT\n"); header("Pragma: private"); // needed for IE header("Cache-Control: private, must-revalidate"); // needed for IE header('Content-type: application/force-download'); header('Content-Transfer-Encoding: Binary'); header("Content-length: " . filesize("/tmp/{$file_name}")); header("Content-disposition: attachment; filename = {$file_name}"); readfile("/tmp/{$file_name}"); ob_end_clean(); //importanr or other post will fail @unlink("/tmp/{$file_name}"); exec("/bin/rm -fr /tmp/snort_blocked"); } else $savemsg = "An error occurred while createing archive"; } else $savemsg = "No content on snort block list"; } if ($_POST['save']) { /* no errors */ if (!$input_errors) { $config['installedpackages']['snortglobal']['alertsblocks']['brefresh'] = $_POST['brefresh'] ? 'on' : 'off'; $config['installedpackages']['snortglobal']['alertsblocks']['blertnumber'] = $_POST['blertnumber']; write_config(); header("Location: /snort/snort_blocked.php"); exit; } } $pgtitle = "Services: Snort Blocked Hosts"; include_once("head.inc"); ?> \n"; ?> ' . $pgtitle . '

';}?>
   
> ', '', '', ''); ?>   ', '', '', ''); ?>
$blocked_msg) { $blocked_desc = implode("
", $blocked_msg); if($counter > $bnentries) break; else $counter++; /* use one echo to do the magic*/ echo "\n"; } } ?>
#
{$counter} {$blocked_ip} {$blocked_desc} \"Delete\"
1) echo "{$counter}" . gettext(" host IP addresses are currently being blocked."); else echo "{$counter}" . gettext(" host IP address is currently being blocked."); } else { echo gettext("There are currently no hosts being blocked by Snort."); } ?>