示例#1
0
if ($_GET["action"] == "addhost") {
    $title = sprintf(_T("Add a host to zone %s"), $zone);
} else {
    $title = _T("Edit host");
}
$p = new PageGenerator($title);
$sidemenu->forceActiveItem("index");
$p->setSideMenu($sidemenu);
$p->display();
global $error;
/* Adding a new record */
if (isset($_POST["badd"])) {
    $hostname = $_POST["hostname"];
    $ipaddress = $_POST["ipaddress"];
    /* Basic checks */
    if (hostExists($zone, $hostname)) {
        $error = _T("The specified hostname has been already recorded in this zone.") . " ";
        setFormError("hostname");
        $hostname = "";
    }
    if (ipExists($zone, $ipaddress)) {
        $error .= _T("The specified IP address has been already recorded in this zone.");
        setFormError("address");
    } else {
        $keepaddress = True;
    }
    if (!isset($error)) {
        $ret = addRecordA($zone, $hostname, $ipaddress);
        if (!isXMLRPCError()) {
            if ($ret === 1) {
                $msg = _T("Host successfully added to DNS zone.");
示例#2
0
    header("Location: main.php?module=network&submod=network&action=subnetmembers&subnet={$subnet}");
    exit;
} else {
    $subnet = urldecode($_GET["subnet"]);
    $host = urldecode($_GET["host"]);
    $askupdatedns = False;
    $domain = "";
    $options = getSubnetOptions(getSubnet($subnet));
    if (isset($options["primarydomainname"])) {
        /*
           If the DHCP domain name option is set, and corresponds to an existing DNS zone
           we ask the user if she/he wants to remove the A record in the DNS zone too.
        */
        $domain = $options["primarydomainname"];
        if (zoneExists($domain)) {
            if (hostExists($domain, $host)) {
                $askupdatedns = True;
            }
        }
    }
}
?>

<p>
<?php 
echo sprintf(_T("You will delete the host %s from the DHCP subnet."), "<strong>{$host}</strong>");
?>
</p>


<form action="main.php?module=network&submod=network&action=subnetdeletehost" method="post">
示例#3
0
 $domain = $subnetOptions["primarydomainname"];
 if (zoneExists($domain)) {
     $f->push(new Table());
     if ($_GET["action"] == "subnetaddhost") {
         /*
             If the DHCP domain name option is set, and corresponds to an existing DNS zone
             we ask the user if she/he wants to record the machine in the DNS zone too.
         */
         $f->add(new TrFormElement(sprintf(_T("Also records this machine into DNS zone %s"), $domain), new CheckboxTpl("dnsrecord")), array("value" => "CHECKED"));
     } else {
         /*
            When editing the host, we display a status about the host registration in the DNS.
         */
         $domainurl = urlStr("network/network/zonemembers", array("zone" => $domain));
         $domainlink = '<a href="' . $domainurl . "\">{$domain}</a>";
         if (hostExists($domain, $hostname)) {
             $f->add(new TrFormElement(sprintf(_T("This host name is also registered in DNS zone %s"), $domainlink), new HiddenTpl("")));
             $resolvedip = resolve($domain, $hostname);
             if (strlen($resolvedip) > 0 && $ipaddress != $resolvedip) {
                 $warn = '<div class="error">' . sprintf(_T("but with another IP address (%s)"), $resolvedip) . '</div>';
                 $f->add(new TrFormElement($warn, new HiddenTpl("")));
             }
         } else {
             $warn = '<div class="error">' . sprintf(_T("This host is not registered in DNS zone %s"), $domainlink) . '</div>';
             $f->add(new TrFormElement($warn, new HiddenTpl("")));
             $newhosturl = urlStr("network/network/addhost", array("zone" => $domain, "host" => $hostname, "ipaddress" => $ipaddress, "gobackto" => rawurlencode($_SERVER["QUERY_STRING"])));
             $newhostlink = '<a href="' . $newhosturl . '">' . _T("Click here to add it") . "</a>";
             $f->add(new TrFormElement($newhostlink, new HiddenTpl("")));
         }
     }
     $f->pop();