Esempio n. 1
0
<?php

require_once "include.php";
$znum = intval($_GET['i']) > 0 ? intval($_GET['i']) : NULL;
if ($znum) {
    if ($user->isOwned($znum, 'master', 'live')) {
        $zone = new masterZone(array('id' => $znum));
        $zone->loadZone();
        $zonerec = $zone->getZoneHead();
        $zrec = array();
        foreach (array('refresh', 'expire', 'retry', 'ttl', 'secured', 'pri_dns', 'sec_dns', 'owner') as $key) {
            $zrec[$key] = (isset($_POST[$key]) and $_POST[$key] > '') ? $_POST[$key] : $zonerec[$key];
        }
        $zrec['valid'] = 'may';
        $zone->setZoneHead($zrec);
        $zone->saveZoneHead();
        $total = isset($_POST['total']) && $_POST['total'] > 0 ? $_POST['total'] : 0;
        for ($x = 0; $x < $total; $x++) {
            if (isset($_POST['delete'][$x])) {
                $zone->eraseRecord(intval($_POST['host_id'][$x]));
            } else {
                $nrec = array();
                foreach (array('host', 'ttl', 'type', 'pri', 'destination') as $key) {
                    $pkey = $key == 'ttl' ? 'rttl' : $key;
                    $nrec[$key] = isset($_POST[$pkey][$x]) ? $_POST[$pkey][$x] : '';
                    $nrec[$key] = $key == 'ttl' && $nrec[$key] == '' ? 0 : $nrec[$key];
                    $nrec[$key] = $key == 'pri' && $nrec[$key] == '' ? 10 : $nrec[$key];
                    $nrec[$key] = $key == 'host' && $nrec[$key] == '' ? '@' : $nrec[$key];
                    $nrec[$key] = $key == 'destination' && $nrec[$key] == '' ? '@' : $nrec[$key];
                }
                if ($nrec['host'] != $nrec['destination']) {
Esempio n. 2
0
<?php

require_once "include.php";
if ($user->isAdmin()) {
    $arr = array('name' => $_POST['name'], 'pri_dns' => $_POST['pri_dns'], 'sec_dns' => $_POST['sec_dns'], 'refresh' => $_POST['refresh'], 'retry' => $_POST['retry'], 'expire' => $_POST['expire'], 'ttl' => $_POST['ttl'], 'owner' => $_POST['owner']);
    $nz = new masterZone($arr);
    if (!$nz->loadZoneHead()) {
        $nz->setZoneHead($arr);
        $nz->saveZoneHead();
        $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';
Esempio n. 3
0
<?php

require_once "include.php";
$zoneid = intval($_GET['i']);
if ($user->isOwned($zoneid, 'master')) {
    if ($zoneid > 0) {
        $zone = new masterZone($zoneid);
        $zone->loadZoneHead();
        $zone->setZoneHead(array('updated' => 'del'));
        $zone->saveZoneHead();
    } else {
        problem();
    }
} else {
    problem("notown");
}