'domain name', 'network_admin' => "network admin's email", 'dns_primary' => 'primary DNS server IP', ); if ($zone && $zone = array_map('stripslashes', array_map('htmlspecialchars', $zone))) { foreach ($required as $tmpfield => $fieldtext) { if (!$zone[$tmpfield]) $missing[] = $fieldtext; } } foreach (array('refresh', 'retry', 'expire', 'ttl') as $timefield) { } function format_hostname($hostname, $domain='') { if ($domain) { $domain = preg_replace('/\./', '\.', $domain); if (preg_match("/(.*)\.$domain\.*$/i", $hostname, $m)) { $hostname = $m[1]; } } else { $hostname = preg_replace('/@/', '.', $hostname); $hostname = preg_replace('/\.*$/', '.', $hostname); } $hostname = preg_replace('/[^0-9a-z.-]/i', '', $hostname); return strtolower($hostname); } ?>
[ back to the ad server index page | php source | convert hosts files to BIND config files ]
Using the form below, you can create a zone file for use with the BIND DNS server. It's pretty basic, but it allows you to import an existing hosts file as the list of A records set up. This is useful for things like ad blocking, as it is much more efficient than distributing hosts files around a network.
Notes:
|
|
; BIND db file for =$zone['domain']?> $TTL =$zone['ttl']?> @ IN SOA =format_hostname($zone['dns_primary'])?> =format_hostname($zone['network_admin'])?> ( =date('Ymd')?>01 ; serial number YYMMDDNN =sprintf('%-15d', $zone['refresh'])?> ; Refresh =sprintf('%-15d', $zone['retry'])?> ; Retry =sprintf('%-15d', $zone['expire'])?> ; Expire =sprintf('%-15d', $zone['ttl'])?> ; Min TTL ) NS =format_hostname($zone['dns_primary'])?> NS =format_hostname($zone['dns_secondary'])?> MX 10 =format_hostname($zone['mx_primary'])?> MX 20 =format_hostname($zone['mx_backup'])?> $ORIGIN =format_hostname($zone['domain'])?> =$host?> IN A =$ip?>