| Linux hosting5.siteguarding.com 3.10.0-962.3.2.lve1.5.88.el7.x86_64 #1 SMP Fri Sep 26 14:06:42 UTC 2025 x86_64 Path : /artem_admin_tools/ |
| Current File : //artem_admin_tools/check_dns.php |
<?php
//Find domains with wrong DNS records
// IP and host variables must be changed for different servers
if(PHP_SAPI !== 'cli') {
echo "this script must be run as a CLI app";
exit(1);
}
$ip = '5.79.91.112';
$data = explode(PHP_EOL,file_get_contents('/etc/userdomains'));
foreach($data as $value){
$flag = false;
$ns_records = array();
$domain = substr($value, 0 ,strpos($value, ':'));
$data_dns = dns_get_record($domain);
foreach($data_dns as $record){
if($record['type'] === 'NS'){
$ns_records[] = $record['target'];
}
if($record['type'] === 'A' && $record['ip'] !== $ip){
$ip_dns = $record['ip'];
$flag = true;
$host_dns = $record['host'];
}
}
if($flag === true) {
echo 'Domain: ' . $host_dns . PHP_EOL;
echo 'A : ' . $ip_dns . PHP_EOL;
echo 'NS : ' . $ns_records[0] . PHP_EOL;
echo 'NS : ' . $ns_records[1] . PHP_EOL;
echo PHP_EOL;
}
}