Re: Binary Files :: They Keep Adding Blocks
| From: | vins | Date: | Thu, 18 Jul 2002 05:14:15 +0000 |
| Subject: | Re: Binary Files :: They Keep Adding Blocks | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-108205@lists.php.net to get a copy of this message | ||
How do i debug.
Thats why i asked
"Vins" <vins@webonline.co.za> wrote in message
news:20020717225559.47790.qmail@pb1.pair.com...
> Hi....
> I've just made this script to update a binary file for my BIND 9 DNS
server.
>
> =======================
> $WorkFile = "domains/db.nom.za";
> $buffer = file($WorkFile);
>
> $DBfile = implode($buffer, "");
> $DBfile = ereg_replace("$domain.nom.za. IN NS $fqdnold[0].",
> "$domain.nom.za. IN NS $fqdnnew[0].", $DBfile);
> $DBfile = ereg_replace("$domain.nom.za. IN NS $fqdnold[1].",
> "$domain.nom.za. IN NS $fqdnnew[1].", $DBfile);
> $DBfile = trim($DBfile)."\n";
>
> $fp = fopen($WorkFile, 'w');
> fwrite($fp, $DBfile);
> fclose($fp);
>
> =======================
>
> Basicall I want to find "dub.domain.com IN NS dns.example.com" and replace
> it with "dub.domain.com IN NS dns1.expample.com". Note the '1' and still
> maintain the format of the file...
>
> My script keeps adding and extra line to every line even when I told it to
> trim.
>
> Any please help
>
> Kindest Regards
> Vins
> :D
>
>