Code:
my ($myrdatsoa,$myrdatns1, $myrdatns2, $myrdatmx1, $myrdata1, $myrdata2) = (undef, undef, undef, undef, undef, undef);
($rs, $myrdatsoa) = doSQL("SELECT IF(
(SELECT t2.id FROM pdns.records t2 WHERE t2.name = '$dmn_name' AND TYPE = 'SOA')>0,
(SELECT t2.id FROM pdns.records t2 WHERE t2.name = '$dmn_name' AND TYPE = 'SOA'),
'NULL')"
);
# return $rs if ($rs != 0);
doSQL("INSERT INTO pdns.records(id, domain_id, name, type, content, ttl, prio, change_date)
SELECT '$myrdatsoa', t1.id, '$dmn_name', 'SOA', concat( 'ns1.deltaweb.de. hostmaster.deltaweb.de.',
CURDATE( ) +0, '00 86400 7200 604800 1800' ) , 21600, 0, Unix_timestamp( )
FROM pdns.domains t1 where t1.name = '$dmn_name'
ON DUPLICATE KEY UPDATE name = '$dmn_name', domain_id = t1.id, type = 'SOA',
content = concat('ns1.deltaweb.de. hostmaster.deltaweb.de.',CURDATE() + 0,'00 86400 7200 604800 1800'),
ttl= 21600,
prio=0,
change_date = Unix_timestamp()"
);
($rs, $myrdatns1) = doSQL("SELECT IF(
(SELECT t2.id FROM pdns.records t2 WHERE t2.name = '$dmn_name' AND t2.type = 'NS' AND t2.content = 'ns1.deltaweb.de')>0,
(SELECT t2.id FROM pdns.records t2 WHERE t2.name = '$dmn_name' AND t2.type = 'NS' AND t2.content = 'ns1.deltaweb.de'),
'NULL')"
);
# return $rs if ($rs != 0);
doSQL("INSERT INTO pdns.records(id, domain_id, name, type, content, ttl, prio, change_date)
SELECT '$myrdatns1', t1.id, '$dmn_name', 'NS', 'ns1.deltaweb.de', ) , 21600, 0, Unix_timestamp( )
FROM pdns.domains t1 where t1.name = '$dmn_name'
ON DUPLICATE KEY UPDATE name = '$dmn_name', domain_id = t1.id, type = 'NS',
content = 'ns1.deltaweb.de',
ttl= 21600,
prio=0,
change_date = Unix_timestamp()"
);
($rs, $myrdatns2) = doSQL("SELECT IF(
(SELECT t2.id FROM pdns.records t2 WHERE t2.name = '$dmn_name' AND t2.type = 'NS' AND t2.content = 'ns2.deltaweb.de')>0,
(SELECT t2.id FROM pdns.records t2 WHERE t2.name = '$dmn_name' AND t2.type = 'NS' AND t2.content = 'ns2.deltaweb.de'),
'NULL')"
);
# return $rs if ($rs != 0);