コード例 #1
0
ファイル: zoneadd.php プロジェクト: PtY1968/smbind-ng
<?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';
コード例 #2
0
ファイル: recordwrite.php プロジェクト: PtY1968/smbind-ng
                    $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();
}