0 ) { $contents2 = fread($filehandle, filesize($file)); }else{ $contents2 = ''; } //close handler fclose ($filehandle); //delimiter for each new rule is a new line $delimiter = "\n"; //split the contents of the string file into an array using the delimiter $splitcontents = explode($delimiter, $contents2); //copy rule contents from array into string $tempstring = $splitcontents[$lineid]; function write_rule_file($content_changed, $received_file) { //read snort file with writing enabled $filehandle = fopen($received_file, "w"); //delimiter for each new rule is a new line $delimiter = "\n"; //implode the array back into a string for writing purposes $fullfile = implode($delimiter, $content_changed); //write data to file fwrite($filehandle, $fullfile); //close file handle fclose($filehandle); } if($_POST['highlight'] <> "") { if($_POST['highlight'] == "yes" or $_POST['highlight'] == "enabled") { $highlight = "yes"; } else { $highlight = "no"; } } else { $highlight = "no"; } if($_POST['rows'] <> "") $rows = $_POST['rows']; else $rows = 1; if($_POST['cols'] <> "") $cols = $_POST['cols']; else $cols = 66; if ($_POST) { if ($_POST['save']) { /* get the changes */ $rule_content2 = $_POST['code']; //copy string into file array for writing $splitcontents[$lineid] = $rule_content2; //write the new .rules file write_rule_file($splitcontents, $file); header("Location: /snort/snort_view_edit.php?id=$id&openruleset=$file&ids=$ids"); } } $pgtitle = array(gettext("Advanced"), gettext("File Editor")); // ?>

' . "\n"; echo 'Disable original rule :'; echo '
'; } ?>