當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Result::validate_hostname方法代碼示例

本文整理匯總了PHP中Result::validate_hostname方法的典型用法代碼示例。如果您正苦於以下問題:PHP Result::validate_hostname方法的具體用法?PHP Result::validate_hostname怎麽用?PHP Result::validate_hostname使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Result的用法示例。


在下文中一共展示了Result::validate_hostname方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: User

$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database);
$Result = new Result();
$PowerDNS = new PowerDNS($Database);
# verify that user is logged in
$User->check_user_session();
# strip input tags
$_POST = $Admin->strip_input_tags($_POST);
# validate csrf cookie
$User->csrf_cookie("validate", "domain", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : "";
# checks / validation
if ($_POST['action'] != "delete") {
    // fqdn
    if ($_POST['action'] == "add") {
        if ($Result->validate_hostname($_POST['name']) === false) {
            $Result->show("danger", "Invalid domain name", true);
        }
    }
    // master
    if (strlen($_POST['master']) > 0) {
        // if multilpe masters
        if (strpos($_POST['master'], ",") !== false) {
            // to array and trim, check each
            $masters = array_filter(explode(",", $_POST['master']));
            foreach ($masters as $m) {
                if (!filter_var($m, FILTER_VALIDATE_IP)) {
                    $Result->show("danger", "Master must be an IP address" . " - " . $m, true);
                }
            }
        } else {
開發者ID:routenull0,項目名稱:phpipam,代碼行數:31,代碼來源:domain-edit-result.php

示例2: array

    $PowerDNS->domain_edit("add", array("name" => $zone, "type" => "NATIVE"));
    // create default records
    $PowerDNS->create_default_records($values);
}
// remove existing records and links
$PowerDNS->remove_all_ptr_records($domain->id);
$Addresses->ptr_unlink_subnet_addresses($subnet->id);
// fetch all hosts
$hosts = $Addresses->fetch_subnet_addresses($subnet->id, "ip_addr", "asc");
// create PTR records
if (sizeof($hosts) > 0) {
    foreach ($hosts as $h) {
        // ignore PTR
        if ($h->PTRignore == "1") {
            $ignored[] = $h;
        } elseif ($Result->validate_hostname($h->dns_name) !== false) {
            // formulate new record
            $record = $PowerDNS->formulate_new_record($domain->id, $PowerDNS->get_ip_ptr_name($h->ip), "PTR", $h->dns_name, $values['ttl']);
            // insert record
            $PowerDNS->add_domain_record($record, false);
            // link
            $Addresses->ptr_link($h->id, $PowerDNS->lastId);
            // ok
            $success[] = $h;
        } else {
            $failures[] = $h;
        }
    }
} else {
    $empty = true;
}
開發者ID:martinsv,項目名稱:phpipam,代碼行數:31,代碼來源:refresh-ptr-records-submit.php


注:本文中的Result::validate_hostname方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。