Skip to content

Commit 1cbeab3

Browse files
committed
FS#769 - DNS Zone - Duplicate entry
1 parent 17db6c1 commit 1cbeab3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

interface/web/dns/dns_a_edit.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ function onSubmit() {
9696
}
9797
} // end if user is not admin
9898

99+
//* Check for duplicates where IP and hostname are the same
100+
$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE zone = '".$this->dataRecord["zone"]."' and data = '".$this->dataRecord["data"]."' and id != ".$this->id);
101+
if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("data_error_duplicate")."<br>";
102+
unset($tmp);
103+
99104

100105
// Set the server ID of the rr record to the same server ID as the parent record.
101106
$this->dataRecord["server_id"] = $soa["server_id"];

interface/web/dns/lib/lang/en_dns_a.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ $wb["name_error_empty"] = 'The hostname is empty.';
1212
$wb["name_error_regex"] = 'The hostname has the wrong format.';
1313
$wb["data_error_empty"] = 'IP-Address empty';
1414
$wb["data_error_regex"] = 'IP-Address format invalid';
15+
$wb["data_error_duplicate"] = 'Duplicate A-Record';
1516
?>

0 commit comments

Comments
 (0)