Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a check for A or AAAA record #196

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

b-boom
Copy link

@b-boom b-boom commented Apr 22, 2014

Add a check for A or AAAA record, they could have the same hostname and add an other naming for SOA (see commit message)

b-boom added 2 commits April 22, 2014 19:12
Add a check for A or AAAA record, they could have the same hostname
For people who use other nameservers than the zpanel default it would be better to name the SOA as the first added namserver.
if (count($dbresult)) {
foreach($dbresult as $row) {
if(($row['dn_type_vc'] == 'A' && $type[$NewId] == 'AAAA') OR ($row['dn_type_vc'] == 'AAAA' && $type[$NewId] == 'A')) {
$exists = ($exists ? true : false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$exists = ($exists ? true : false); does exactely ... nothing !

I'm afraid that there is something to redesign here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a loop through all records. If there is a record wich exists $exists = true, but if the next record not is the same the $exists will not be reset to false because it is already true.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With $exists = ($exists ? true : false);

  • If $exists is true, it will turned to true,
  • if $exists is false, it wll be turned to false.

=> $exists will never change (by this line), so the test and the loop have no sense !

did you want to enable both A and AAAA record for the same domain ?

It would be better to change only the query, something like :

$numrows = $zdbh->prepare('SELECT dn_id_pk FROM x_dns WHERE dn_host_vc=:hostName2 AND dn_vhost_fk=:domainID AND dn_type_vc<>:excludetype AND dn_deleted_ts IS NULL');
$hostName2 = $hostName[$NewId];
$numrows->bindParam(':hostName2', $hostName2);
$numrows->bindParam(':domainID', $domainID);
$numrows->bindParam(':excludetype', ($type[$NewId] == 'A') ? 'AAAA' : 'A' );
$numrows->execute();
.....

but i have not enought ime here to check and validate. Sorry :-(

@b-boom
Copy link
Author

b-boom commented May 6, 2014

@5050 I think it's better now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants