0 ) $contents = file_get_contents($file); //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, $contents); $findme = "# alert"; //find string for disabled alerts $highlight = "yes"; if (strstr($splitcontents[$lineid], $findme)) $highlight = "no"; if ($highlight == "no") $splitcontents[$lineid] = substr($splitcontents[$lineid], 2); if ($_POST) { if ($_POST['save']) { //copy string into file array for writing if ($_POST['highlight'] == "yes") $splitcontents[$lineid] = $_POST['code']; else $splitcontents[$lineid] = "# " . $_POST['code']; //write the new .rules file @file_put_contents($file, implode($delimiter, $splitcontents)); echo ""; exit; } } $pgtitle = array(gettext("Advanced"), gettext("File Editor")); ?>