equal
deleted
inserted
replaced
26 |
26 |
27 /* |
27 /* |
28 * Validates an IPv4 IP. |
28 * Validates an IPv4 IP. |
29 * returns true if valid. |
29 * returns true if valid. |
30 */ |
30 */ |
31 function validate_input($recordid, $zoneid, $type, &$content, &$name, &$prio, &$ttl) |
31 function validate_input($zoneid, $type, &$content, &$name, &$prio, &$ttl) |
32 { |
32 { |
33 global $db; |
33 global $db; |
34 |
34 |
35 // Has to validate content first then it can do the rest |
35 // Has to validate content first then it can do the rest |
36 // Since if content is invalid already it can aswell be just removed |
36 // Since if content is invalid already it can aswell be just removed |
385 function is_valid_mx($content, &$prio) |
385 function is_valid_mx($content, &$prio) |
386 { |
386 { |
387 global $db; |
387 global $db; |
388 // See if the destination to which this MX is pointing is NOT a CNAME record. |
388 // See if the destination to which this MX is pointing is NOT a CNAME record. |
389 // Check inside our dns server. |
389 // Check inside our dns server. |
390 if($db->getOne("SELECT count(id) FROM records WHERE name='$content' AND type='CNAME'") > 0) |
390 if($db->queryOne("SELECT count(id) FROM records WHERE name='$content' AND type='CNAME'") > 0) |
391 { |
391 { |
392 return -1; |
392 return -1; |
393 } |
393 } |
394 else |
394 else |
395 { |
395 { |
428 { |
428 { |
429 return -1; |
429 return -1; |
430 // "an IN NS field must be a hostname." |
430 // "an IN NS field must be a hostname." |
431 } |
431 } |
432 |
432 |
433 if($db->getOne("SELECT count(id) FROM records WHERE name='$content' AND type='CNAME'") > 0) |
433 if($db->queryOne("SELECT count(id) FROM records WHERE name='$content' AND type='CNAME'") > 0) |
434 { |
434 { |
435 return -2; |
435 return -2; |
436 // "You can not point a NS record to a CNAME record. Remove/rename the CNAME record first or take another name." |
436 // "You can not point a NS record to a CNAME record. Remove/rename the CNAME record first or take another name." |
437 |
437 |
438 } |
438 } |