I'm attempting to open a file for writing, and check the file for certain strings, and if a replacement string is defined, replace it. Specifically, I'm setting up a config file to define varaibles, and this script will edit the config file, so manual editing is not necissary. Here is the trouble code:
$fp = fopen("C:\Apache\Apache\htdocs\rms.conf", "r+");
while (!feof($fp)){
$line = fgets($fp, 80);
if(ereg($check_that[$i], $line)){
$newline=ereg_replace ($check_that[$i]." = \"(.*)\"", $check_that[$i]." = \"".$check_this[$i]."\"", $line);
}
fputs($fp, $newline);
$i++;
}
fclose($fp);
Repor