Пример #1
0
            $updateiprec = 1;
        }
    }
}
// ##################### START OF Add ##############################
if ($action == "add") {
    if (!($dom_id = $ds->ds->GetOne("SELECT data_id\n                FROM fwdzone\n                WHERE customer={$cust} AND data_id={$zoneid}"))) {
        myError($w, $p, my_("Could not find the zone - possibly deleted by another user"));
    }
    // Add to DB here.
    // Log the Transaction.
    $ds->DbfTransactionStart();
    // do update of ip record with hostname as part of transaction
    if ($updateiprec) {
        $fqdn = substr($host, -1, 1) == "." ? substr($host, 0, -1) : "{$host}.{$domain}";
        $result = $ds->GetBaseFromIP(inet_aton($iphostname), $cust);
        if ($row = $result->FetchRow()) {
            $baseindex = $row["baseindex"];
            $ds->ModifyIP(array(inet_aton($iphostname)), $baseindex, "", "", "", "", "", $fqdn, "");
            // not really an error, but a warning?
            $formerror .= my_("Subnet IP record updated with hostname: ") . "{$fqdn}\n";
        }
    }
    $result =& $ds->ds->Execute("INSERT into fwdzonerec \n            (customer, data_id, sortorder, lastmod, host, \n             recordtype, userid, ip_hostname) " . "VALUES ({$cust}, {$zoneid}, " . $sortorder . "," . $ds->ds->DBTimeStamp(time()) . "," . $ds->ds->qstr($host) . "," . $ds->ds->qstr($recordtype) . "," . $ds->ds->qstr(getAuthUsername()) . "," . $ds->ds->qstr($iphostname) . ")") and $ds->ds->Execute("UPDATE fwdzone \n            SET error_message=" . $ds->ds->qstr("E") . ",\n            lastmod=" . $ds->ds->DBTimeStamp(time()) . " WHERE customer={$cust} AND data_id=" . $dom_id) and $ds->AuditLog(array("event" => 121, "action" => "add zone record", "cust" => $cust, "user" => getAuthUsername(), "domain" => $domain, "host" => $host, "recordtype" => $recordtype, "iphostname" => $iphostname));
    if ($result) {
        $ds->DbfTransactionEnd();
        insert($w, textbr(my_("Host record added.")));
        $zone = "";
    } else {
        $ds->DbfTransactionRollback();
        $formerror .= my_("Host record could not be added.") . "\n";