$www = isset($_POST['www']) && $_POST['www'] > '' ? $_POST['www'] : NULL; if ($www) { $type = filter_var($www, FILTER_VALIDATE_IP) ? 'A' : 'CNAME'; if ($type == 'A') { $nz->addRecord(array('host' => '@', 'type' => 'A', 'destination' => $www)); $nz->addRecord(array('host' => 'www', 'type' => 'CNAME', 'destination' => '@')); } else { $nz->addRecord(array('host' => 'www', 'type' => 'CNAME', 'destination' => $www)); } } $ftp = isset($_POST['ftp']) && $_POST['ftp'] > '' ? $_POST['ftp'] : NULL; if ($ftp) { $type = filter_var($ftp, FILTER_VALIDATE_IP) ? 'A' : 'CNAME'; $nz->addRecord(array('host' => 'ftp', 'type' => $type, 'destination' => $ftp)); } $mail = isset($_POST['mail']) && $_POST['mail'] > '' ? $_POST['mail'] : NULL; if ($mail) { $type = filter_var($mail, FILTER_VALIDATE_IP) ? 'A' : 'MX'; $destination = $type == 'A' ? 'mail' : $mail; if ($type == 'A') { $nz->addRecord(array('host' => 'mail', 'type' => $type, 'destination' => $mail)); $type = 'MX'; } $nz->addRecord(array('host' => '@', 'type' => $type, 'destination' => $destination, 'pri' => 10)); } $nz->saveZone(); $user->loadUserZones(); } else { problem("existzone"); } }
$nrec[$key] = $key == 'host' && $nrec[$key] == '' ? '@' : $nrec[$key]; $nrec[$key] = $key == 'destination' && $nrec[$key] == '' ? '@' : $nrec[$key]; } if ($nrec['host'] != $nrec['destination']) { $urec = new masterRecord(intval($_POST['host_id'][$x])); $urec->loadRecord(); $urec->setRecord($nrec); $xrec = $urec->getRecordRaw(); $urec->saveRecord(); } } } $zone->clearZone(); $zone->loadZone(); $nrec = array(); foreach (array('host', 'ttl', 'type', 'pri', 'destination') as $key) { $nrec[$key] = isset($_POST['new' . $key]) && $_POST['new' . $key] > '' ? $_POST['new' . $key] : NULL; } if ($nrec['host'] != $nrec['destination']) { $nrec['pri'] = $nrec['type'] == 'MX' ? 10 : 0; $nrec['ttl'] = intval($nrec['ttl']); $nrec['zone'] = $znum; $zone->addRecord($nrec); } $zone->saveZone(); } else { problem("notown"); } } else { access_denied(); }