• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is_hostname函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中is_hostname函数的典型用法代码示例。如果您正苦于以下问题:PHP is_hostname函数的具体用法?PHP is_hostname怎么用?PHP is_hostname使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了is_hostname函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: pfSenseHeader

 } else {
     if ($config['openvpn']['openvpn-server'][$srvid]['mode'] != "server_user" && ($usrid === false || $crtid === false)) {
         pfSenseHeader("vpn_openvpn_export.php");
         exit;
     }
 }
 if ($config['openvpn']['openvpn-server'][$srvid]['mode'] == "server_user") {
     $nokeys = true;
 } else {
     $nokeys = false;
 }
 $useaddr = '';
 if (isset($_GET['useaddr']) && !empty($_GET['useaddr'])) {
     $useaddr = trim($_GET['useaddr']);
 }
 if (!(is_ipaddr($useaddr) || is_hostname($useaddr) || in_array($useaddr, array("serveraddr", "servermagic", "servermagichost", "serverhostname")))) {
     $input_errors[] = "You need to specify an IP or hostname.";
 }
 $advancedoptions = $_GET['advancedoptions'];
 $openvpnmanager = $_GET['openvpnmanager'];
 $verifyservercn = $_GET['verifyservercn'];
 $randomlocalport = $_GET['randomlocalport'];
 $usetoken = $_GET['usetoken'];
 if ($usetoken && substr($act, 0, 10) == "confinline") {
     $input_errors[] = "You cannot use Microsoft Certificate Storage with an Inline configuration.";
 }
 if ($usetoken && ($act == "conf_yealink_t28" || $act == "conf_yealink_t38g" || $act == "conf_yealink_t38g2" || $act == "conf_snom")) {
     $input_errors[] = "You cannot use Microsoft Certificate Storage with a Yealink or SNOM configuration.";
 }
 $password = "";
 if ($_GET['password']) {
开发者ID:LFCavalcanti,项目名称:pfsense-packages,代码行数:31,代码来源:vpn_openvpn_export.php


示例2: gettext

 $pconfig = $_POST;
 /* input validation */
 if ($_POST['webguiport']) {
     if (!is_port($_POST['webguiport'])) {
         $input_errors[] = gettext("You must specify a valid webConfigurator port number");
     }
 }
 if ($_POST['max_procs']) {
     if (!is_numericint($_POST['max_procs']) || $_POST['max_procs'] < 1 || $_POST['max_procs'] > 500) {
         $input_errors[] = gettext("Max Processes must be a number 1 or greater");
     }
 }
 if ($_POST['althostnames']) {
     $althosts = explode(" ", $_POST['althostnames']);
     foreach ($althosts as $ah) {
         if (!is_hostname($ah)) {
             $input_errors[] = sprintf(gettext("Alternate hostname %s is not a valid hostname."), htmlspecialchars($ah));
         }
     }
 }
 if ($_POST['sshport']) {
     if (!is_port($_POST['sshport'])) {
         $input_errors[] = gettext("You must specify a valid port number");
     }
 }
 if ($_POST['sshdkeyonly'] == "yes") {
     $config['system']['ssh']['sshdkeyonly'] = "enabled";
 } else {
     if (isset($config['system']['ssh']['sshdkeyonly'])) {
         unset($config['system']['ssh']['sshdkeyonly']);
     }
开发者ID:calvinbui,项目名称:pfsense,代码行数:31,代码来源:system_advanced_admin.php


示例3: gettext

 if ($_POST['pppoe_resethour'] != "" && !is_numericint($_POST['pppoe_resethour']) && $_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <= 23) {
     $input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
 }
 if ($_POST['pppoe_resetminute'] != "" && !is_numericint($_POST['pppoe_resetminute']) && $_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <= 59) {
     $input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
 }
 if ($_POST['pppoe_resetdate'] != "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))) {
     $input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
 }
 if ($_POST['pptp_local0'] && !is_ipaddrv4($_POST['pptp_local0'])) {
     $input_errors[] = gettext("A valid PPTP local IP address must be specified.");
 }
 if ($_POST['pptp_subnet0'] && !is_numeric($_POST['pptp_subnet0'])) {
     $input_errors[] = gettext("A valid PPTP subnet bit count must be specified.");
 }
 if ($_POST['pptp_remote0'] && !is_ipaddrv4($_POST['pptp_remote0']) && !is_hostname($_POST['gateway'][$iface])) {
     $input_errors[] = gettext("A valid PPTP remote IP address must be specified.");
 }
 if ($_POST['pptp_idletimeout'] != "" && !is_numericint($_POST['pptp_idletimeout'])) {
     $input_errors[] = gettext("The idle timeout value must be an integer.");
 }
 if ($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac'])) {
     $input_errors[] = gettext("A valid MAC address must be specified.");
 }
 if ($_POST['mtu']) {
     if (!is_numericint($_POST['mtu'])) {
         $input_errors[] = "MTU must be an integer.";
     }
     if (substr($wancfg['if'], 0, 3) == 'gif') {
         $min_mtu = 1280;
         $max_mtu = 8192;
开发者ID:simudream,项目名称:pfsense,代码行数:31,代码来源:interfaces.php


示例4: array

     $reqdfieldsn = array(gettext("Existing Certificate Choice"));
 }
 $altnames = array();
 do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
 if (isset($pconfig['altname_value']) && $pconfig['certmethod'] != "import" && $pconfig['certmethod'] != "existing") {
     /* subjectAltNames */
     foreach ($pconfig['altname_type'] as $altname_seq => $altname_type) {
         if (!empty($pconfig['altname_value'][$altname_seq])) {
             $altnames[] = array("type" => $altname_type, "value" => $pconfig['altname_value'][$altname_seq]);
         }
     }
     /* Input validation for subjectAltNames */
     foreach ($altnames as $altname) {
         switch ($altname['type']) {
             case "DNS":
                 if (!is_hostname($altname['value'])) {
                     $input_errors[] = gettext("DNS subjectAltName values must be valid hostnames or FQDNs");
                 }
                 break;
             case "IP":
                 if (!is_ipaddr($altname['value'])) {
                     $input_errors[] = gettext("IP subjectAltName values must be valid IP Addresses");
                 }
                 break;
             case "email":
                 if (empty($altname['value'])) {
                     $input_errors[] = gettext("You must provide an e-mail address for this type of subjectAltName");
                 }
                 if (preg_match("/[\\!\\#\$\\%\\^\\(\\)\\~\\?\\>\\<\\&\\/\\\\,\"\\']/", $altname['value'])) {
                     $input_errors[] = gettext("The e-mail provided in a subjectAltName contains invalid characters.");
                 }
开发者ID:paudam,项目名称:opnsense-core,代码行数:31,代码来源:system_certmanager.php


示例5: gettext

                         if ($numberoption['type'] == 'unsigned integer 16' && (!is_numeric($numberoption['value']) || $numberoption['value'] < 0 || $numberoption['value'] > 65535)) {
                             $input_errors[] = gettext("Unsigned 16-bit integer type must be a number in the range 0 to 65535.");
                         } else {
                             if ($numberoption['type'] == 'unsigned integer 32' && (!is_numeric($numberoption['value']) || $numberoption['value'] < 0 || $numberoption['value'] > 4294967295)) {
                                 $input_errors[] = gettext("Unsigned 32-bit integer type must be a number in the range 0 to 4294967295.");
                             } else {
                                 if ($numberoption['type'] == 'signed integer 8' && (!is_numeric($numberoption['value']) || $numberoption['value'] < -128 || $numberoption['value'] > 127)) {
                                     $input_errors[] = gettext("Signed 8-bit integer type must be a number in the range -128 to 127.");
                                 } else {
                                     if ($numberoption['type'] == 'signed integer 16' && (!is_numeric($numberoption['value']) || $numberoption['value'] < -32768 || $numberoption['value'] > 32767)) {
                                         $input_errors[] = gettext("Signed 16-bit integer type must be a number in the range -32768 to 32767.");
                                     } else {
                                         if ($numberoption['type'] == 'signed integer 32' && (!is_numeric($numberoption['value']) || $numberoption['value'] < -2147483648 || $numberoption['value'] > 2147483647)) {
                                             $input_errors[] = gettext("Signed 32-bit integer type must be a number in the range -2147483648 to 2147483647.");
                                         } else {
                                             if ($numberoption['type'] == 'ip-address' && !is_ipaddrv4($numberoption['value']) && !is_hostname($numberoption['value'])) {
                                                 $input_errors[] = gettext("IP address or host type must be an IP address or host name.");
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 if (!$input_errors) {
     /* make sure the range lies within the current subnet */
开发者ID:karawan,项目名称:core,代码行数:31,代码来源:services_dhcp.php


示例6: trim

 $_POST["address{$x}"] = trim($_POST["address{$x}"]);
 if (is_alias($_POST["address{$x}"])) {
     if (!alias_same_type($_POST["address{$x}"], $_POST['type'])) {
         // But alias type network can include alias type urltable. Feature#1603.
         if (!($_POST['type'] == 'network' && preg_match("/urltable/i", alias_get_type($_POST["address{$x}"])))) {
             $wrongaliases .= " " . $_POST["address{$x}"];
         }
     }
 } else {
     if ($_POST['type'] == "port") {
         if (!is_port($_POST["address{$x}"]) && !is_portrange($_POST["address{$x}"])) {
             $input_errors[] = $_POST["address{$x}"] . " " . gettext("is not a valid port or alias.");
         }
     } else {
         if ($_POST['type'] == "host" || $_POST['type'] == "network") {
             if (is_subnet($_POST["address{$x}"]) || !is_ipaddr($_POST["address{$x}"]) && !is_hostname($_POST["address{$x}"]) && !is_iprange($_POST["address{$x}"])) {
                 $input_errors[] = sprintf(gettext('%1$s is not a valid %2$s alias.'), $_POST["address{$x}"], $_POST['type']);
             }
         }
     }
 }
 if (is_iprange($_POST["address{$x}"])) {
     list($startip, $endip) = explode('-', $_POST["address{$x}"]);
     $rangesubnets = ip_range_to_subnet_array($startip, $endip);
     $address = array_merge($address, $rangesubnets);
 } else {
     $tmpaddress = $_POST["address{$x}"];
     if ($_POST['type'] != "host" && is_ipaddr($_POST["address{$x}"]) && $_POST["address_subnet{$x}"] != "") {
         if (!is_subnet($_POST["address{$x}"] . "/" . $_POST["address_subnet{$x}"])) {
             $input_errors[] = sprintf(gettext('%s/%s is not a valid subnet.'), $_POST["address{$x}"], $_POST["address_subnet{$x}"]);
         } else {
开发者ID:wcchandler,项目名称:pfsense,代码行数:31,代码来源:firewall_aliases_edit.php


示例7: gettext

         $input_errors[] = gettext("A valid PPPoE reset month must be specified (1-12) in the Custom PPPoE Periodic reset fields.");
     }
     if ($date_nums[1] < 1 || $date_nums[1] > 31) {
         $input_errors[] = gettext("A valid PPPoE reset day of month must be specified (1-31) in the Custom PPPoE Periodic reset fields. No checks are done on valid # of days per month");
     }
     if ($date_nums[2] < date("Y")) {
         $input_errors[] = gettext("A valid PPPoE reset year must be specified. Don't select a year in the past!");
     }
 }
 $port_data = array();
 if (is_array($_POST['interfaces'])) {
     foreach ($_POST['interfaces'] as $iface) {
         if ($_POST['localip'][$iface] && !is_ipaddr($_POST['localip'][$iface])) {
             $input_errors[] = sprintf(gettext("A valid local IP address must be specified for %s."), $iface);
         }
         if ($_POST['gateway'][$iface] && !is_ipaddr($_POST['gateway'][$iface]) && !is_hostname($_POST['gateway'][$iface])) {
             $input_errors[] = sprintf(gettext("A valid gateway IP address OR hostname must be specified for %s."), $iface);
         }
         if ($_POST['bandwidth'][$iface] && !is_numericint($_POST['bandwidth'][$iface])) {
             $input_errors[] = sprintf(gettext("The bandwidth value for %s must be an integer."), $iface);
         }
         if ($_POST['mtu'][$iface] && $_POST['mtu'][$iface] < 576) {
             $input_errors[] = sprintf(gettext("The MTU for %s must be greater than 576 bytes."), $iface);
         }
         if ($_POST['mru'][$iface] && $_POST['mru'][$iface] < 576) {
             $input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."), $iface);
         }
     }
     // Loop through fields associated with an individual link/port and make an array of the data
     $port_fields = array("localip", "gateway", "subnet", "bandwidth", "mtu", "mru", "mrru");
     foreach ($_POST['interfaces'] as $iface) {
开发者ID:LFCavalcanti,项目名称:pfsense,代码行数:31,代码来源:interfaces_ppps_edit.php


示例8: elseif

     } elseif (!substr_compare('aliasdescription', $key, 0, 16)) {
         $entry = substr($key, 16);
         $field = 'description';
     }
     if (ctype_digit($entry)) {
         $aliases[$entry][$field] = $value;
     }
 }
 $pconfig['aliases']['item'] = $aliases;
 /* validate aliases */
 foreach ($aliases as $idx => $alias) {
     $aliasreqdfields = array('aliasdomain' . $idx);
     $aliasreqdfieldsn = array(gettext("Alias Domain"));
     var_dump(array('fields' => $aliasreqdfields, 'names' => $aliasreqdfieldsn, 'alias' => $alias));
     do_input_validation($_POST, $aliasreqdfields, $aliasreqdfieldsn, $input_errors);
     if ($alias['host'] && !is_hostname($alias['host'])) {
         $input_errors[] = gettext("Hostnames in alias list can only contain the characters A-Z, 0-9 and '-'.");
     }
     if ($alias['domain'] && !is_domain($alias['domain'])) {
         $input_errors[] = gettext("A valid domain must be specified in alias list.");
     }
 }
 /* check for overlaps */
 foreach ($a_hosts as $hostent) {
     if (isset($id) && $a_hosts[$id] && $a_hosts[$id] === $hostent) {
         continue;
     }
     if ($hostent['host'] == $_POST['host'] && $hostent['domain'] == $_POST['domain'] && (is_ipaddrv4($hostent['ip']) && is_ipaddrv4($_POST['ip']) || is_ipaddrv6($hostent['ip']) && is_ipaddrv6($_POST['ip']))) {
         $input_errors[] = gettext("This host/domain already exists.");
         break;
     }
开发者ID:siloportem,项目名称:core,代码行数:31,代码来源:services_unbound_host_edit.php


示例9: array

##|*NAME=Diagnostics: Test Port
##|*DESCR=Allow access to the 'Diagnostics: Test Port' page.
##|*MATCH=diag_testport.php*
##|-PRIV
$allowautocomplete = true;
$pgtitle = array(gettext("Diagnostics"), gettext("Test Port"));
require "guiconfig.inc";
define('NC_TIMEOUT', 10);
if ($_POST || $_REQUEST['host']) {
    unset($input_errors);
    unset($do_testport);
    /* input validation */
    $reqdfields = explode(" ", "host port");
    $reqdfieldsn = array(gettext("Host"), gettext("Port"));
    do_input_validation($_REQUEST, $reqdfields, $reqdfieldsn, $input_errors);
    if (!is_ipaddr($_REQUEST['host']) && !is_hostname($_REQUEST['host'])) {
        $input_errors[] = gettext("Please enter a valid IP or hostname.");
    }
    if (!is_port($_REQUEST['port'])) {
        $input_errors[] = gettext("Please enter a valid port number.");
    }
    if (!is_numeric($_REQUEST['srcport']) || !is_port($_REQUEST['srcport'])) {
        $input_errors[] = gettext("Please enter a valid source port number, or leave the field blank.");
    }
    if (is_ipaddrv4($_REQUEST['host']) && $_REQUEST['ipprotocol'] == "ipv6") {
        $input_errors[] = gettext("You cannot connect to an IPv4 address using IPv6.");
    }
    if (is_ipaddrv6($_REQUEST['host']) && $_REQUEST['ipprotocol'] == "ipv4") {
        $input_errors[] = gettext("You cannot connect to an IPv6 address using IPv4.");
    }
    if (!$input_errors) {
开发者ID:mtisza,项目名称:pfsense,代码行数:31,代码来源:diag_testport.php


示例10: gettext

 if (!empty($pconfig['pppoe-reset-type'])) {
     if (!empty($pconfig['pppoe_resethour']) && (!is_numericint($pconfig['pppoe_resethour']) || $pconfig['pppoe_resethour'] < 0 || $pconfig['pppoe_resethour'] > 23)) {
         $input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
     }
     if (!empty($pconfig['pppoe_resetminute']) && (!is_numericint($pconfig['pppoe_resetminute']) || $pconfig['pppoe_resetminute'] < 0 || $pconfig['pppoe_resetminute'] > 59)) {
         $input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
     }
     if (!empty($pconfig['pppoe_resetdate']) && !is_numeric(str_replace("/", "", $pconfig['pppoe_resetdate']))) {
         $input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
     }
 }
 foreach ($pconfig['ports'] as $iface_idx => $iface) {
     if (!empty($pconfig['localip'][$iface_idx]) && !is_ipaddr($pconfig['localip'][$iface_idx])) {
         $input_errors[] = sprintf(gettext("A valid local IP address must be specified for %s."), $iface);
     }
     if (!empty($pconfig['gateway'][$iface_idx]) && !is_ipaddr($pconfig['gateway'][$iface_idx]) && !is_hostname($pconfig['gateway'][$iface_idx])) {
         $input_errors[] = sprintf(gettext("A valid gateway IP address OR hostname must be specified for %s."), $iface);
     }
     if (!empty($pconfig['bandwidth'][$iface_idx]) && !is_numericint($pconfig['bandwidth'][$iface_idx])) {
         $input_errors[] = sprintf(gettext("The bandwidth value for %s must be an integer."), $iface);
     }
     if (!empty($pconfig['mtu'][$iface_idx]) && $pconfig['mtu'][$iface_idx] < 576) {
         $input_errors[] = sprintf(gettext("The MTU for %s must be greater than 576 bytes."), $iface);
     }
     if (!empty($pconfig['mru'][$iface_idx]) && $pconfig['mru'][$iface_idx] < 576) {
         $input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."), $iface);
     }
 }
 if (count($input_errors) == 0) {
     $ppp = array();
     $ppp['ptpid'] = $pconfig['ptpid'];
开发者ID:8191,项目名称:opnsense-core,代码行数:31,代码来源:interfaces_ppps_edit.php


示例11: redirectHeader

        redirectHeader("vpn_openvpn_export.php");
        exit;
    }

    if ($config['openvpn']['openvpn-server'][$srvid]['mode'] == "server_user") {
        $nokeys = true;
    } else {
        $nokeys = false;
    }

    $useaddr = '';
    if (isset($_GET['useaddr']) && !empty($_GET['useaddr'])) {
        $useaddr = trim($_GET['useaddr']);
    }

    if (!(is_ipaddr($useaddr) || is_hostname($useaddr) ||
        in_array($useaddr, array("serveraddr", "servermagic", "servermagichost", "serverhostname")))) {
        $input_errors[] = "You need to specify an IP or hostname.";
    }

    $advancedoptions = $_GET['advancedoptions'];
    $openvpnmanager = $_GET['openvpnmanager'];

    $verifyservercn = $_GET['verifyservercn'];
    $randomlocalport = $_GET['randomlocalport'];
    $usetoken = $_GET['usetoken'];
    if ($usetoken && (substr($act, 0, 10) == "confinline")) {
        $input_errors[] = "You cannot use Microsoft Certificate Storage with an Inline configuration.";
    }
    if ($usetoken && (($act == "conf_yealink_t28") || ($act == "conf_yealink_t38g") || ($act == "conf_yealink_t38g2") || ($act == "conf_snom"))) {
        $input_errors[] = "You cannot use Microsoft Certificate Storage with a Yealink or SNOM configuration.";
开发者ID:Toudix,项目名称:core,代码行数:31,代码来源:vpn_openvpn_export.php


示例12: array

if ($_SERVER['REQUEST_METHOD'] === 'GET') {
    // set form defaults
    $pconfig = array();
    $pconfig['ipprotocol'] = 'ipv4';
    $pconfig['host'] = null;
    $pconfig['port'] = null;
    $pconfig['showtext'] = null;
    $pconfig['sourceip'] = null;
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $pconfig = $_POST;
    $input_errors = array();
    /* input validation */
    $reqdfields = explode(" ", "host port");
    $reqdfieldsn = array(gettext("Host"), gettext("Port"));
    do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
    if (!is_ipaddr($pconfig['host']) && !is_hostname($pconfig['host'])) {
        $input_errors[] = gettext("Please enter a valid IP or hostname.");
    }
    if (!is_port($pconfig['port'])) {
        $input_errors[] = gettext("Please enter a valid port number.");
    }
    if ($pconfig['srcport'] != "" && (!is_numeric($pconfig['srcport']) || !is_port($pconfig['srcport']))) {
        $input_errors[] = gettext("Please enter a valid source port number, or leave the field blank.");
    }
    if (is_ipaddrv4($pconfig['host']) && $pconfig['ipprotocol'] == "ipv6") {
        $input_errors[] = gettext("You cannot connect to an IPv4 address using IPv6.");
    }
    if (is_ipaddrv6($pconfig['host']) && $pconfig['ipprotocol'] == "ipv4") {
        $input_errors[] = gettext("You cannot connect to an IPv6 address using IPv4.");
    }
    if (count($input_errors) == 0) {
开发者ID:paudam,项目名称:opnsense-core,代码行数:31,代码来源:diag_testport.php


示例13: elseif

                 } else {
                 }
             } else {
             }
         }
     }
     $subnet = $config['interfaces']['lan']['ipaddr'] . "/" . $config['interfaces']['lan']['subnet'];
     if (is_ipaddr($_POST['ipadress'])) {
         if (false == ($cnif = ip_in_subnet($_POST['ipadress'], $subnet))) {
             $input_errors[] = "Value \"IP address\" is not belongs to the subnet LAN";
             goto out;
         } else {
         }
     }
 } elseif (empty($_POST['macaddr']) && empty($_POST['ipadress']) && !empty($_POST['hostname'])) {
     if (FALSE == is_hostname($_POST['hostname'])) {
         $input_errors[] = "Wrong Host name.";
         goto out;
     } else {
         $pconfig['leasetime'] = "60";
         $nas4frehosts =& $config['system']['hosts'];
         if (false !== ($cnin = array_search_ex($_POST['hostname'], $nas4frehosts, "name"))) {
             $warning_mess = "Host defined on <a href=system_hosts.php>/etc/hosts</a>";
         } else {
             if ($_POST['hostname'] == $config['system']['hostname']) {
                 $input_errors[] = "You can not define main host as DHCP client";
                 goto out;
             } else {
                 $warning_mess = "Host NOT defined on <a href=system_hosts.php>/etc/hosts</a>, please define it";
             }
         }
开发者ID:Artiom-M,项目名称:nas4free-dnsmasq,代码行数:31,代码来源:extensions_dnsmasq_hosts.php


示例14: gettext

 if ($_POST["address{$x}"] != "") {
     if (is_alias($_POST["address{$x}"])) {
         if (!alias_same_type($_POST["address{$x}"], $_POST['type'])) {
             // But alias type network can include alias type urltable. Feature#1603.
             if (!($_POST['type'] == 'network' && alias_get_type($_POST["address{$x}"]) == 'urltable')) {
                 $wrongaliases .= " " . $_POST["address{$x}"];
             }
         }
     } else {
         if ($_POST['type'] == "port") {
             if (!is_port($_POST["address{$x}"])) {
                 $input_errors[] = $_POST["address{$x}"] . " " . gettext("is not a valid port or alias.");
             }
         } else {
             if ($_POST['type'] == "host" || $_POST['type'] == "network") {
                 if (!is_ipaddr($_POST["address{$x}"]) && !is_hostname($_POST["address{$x}"]) && !is_iprange($_POST["address{$x}"])) {
                     $input_errors[] = sprintf(gettext('%1$s is not a valid %2$s alias.'), $_POST["address{$x}"], $_POST['type']);
                 }
             }
         }
     }
     if (is_iprange($_POST["address{$x}"])) {
         list($startip, $endip) = explode('-', $_POST["address{$x}"]);
         $rangesubnets = ip_range_to_subnet_array($startip, $endip);
         $address = array_merge($address, $rangesubnets);
     } else {
         $tmpaddress = $_POST["address{$x}"];
         if (is_ipaddr($_POST["address{$x}"]) && $_POST["address_subnet{$x}"] != "") {
             $tmpaddress .= "/" . $_POST["address_subnet{$x}"];
         }
         $address[] = $tmpaddress;
开发者ID:rdmenezes,项目名称:pfsense,代码行数:31,代码来源:firewall_aliases_edit.php


示例15: elseif

     } elseif (!substr_compare('altname_value', $key, 0, 13)) {
         $entry = substr($key, 13);
         $field = 'value';
     }
     if (ctype_digit($entry)) {
         $entry++;
         // Pre-bootstrap code is one-indexed, but the bootstrap code is 0-indexed
         $altnames[$entry][$field] = $value;
     }
 }
 $pconfig['altnames']['item'] = $altnames;
 /* Input validation for subjectAltNames */
 foreach ($altnames as $idx => $altname) {
     switch ($altname['type']) {
         case "DNS":
             if (!is_hostname($altname['value'], true)) {
                 array_push($input_errors, "DNS subjectAltName values must be valid hostnames, FQDNs or wildcard domains.");
             }
             break;
         case "IP":
             if (!is_ipaddr($altname['value'])) {
                 array_push($input_errors, "IP subjectAltName values must be valid IP Addresses");
             }
             break;
         case "email":
             if (empty($altname['value'])) {
                 array_push($input_errors, "You must provide an e-mail address for this type of subjectAltName");
             }
             if (preg_match("/[\\!\\#\$\\%\\^\\(\\)\\~\\?\\>\\<\\&\\/\\\\,\"\\']/", $altname['value'])) {
                 array_push($input_errors, "The e-mail provided in a subjectAltName contains invalid characters.");
             }
开发者ID:michaeleino,项目名称:pfsense,代码行数:31,代码来源:system_certmanager.php


示例16: elseif

     } elseif (!substr_compare('aliasdescription', $key, 0, 16)) {
         $entry = substr($key, 16);
         $field = 'description';
     }
     if (ctype_digit($entry)) {
         $aliases[$entry][$field] = $value;
     }
 }
 $pconfig['aliases']['item'] = $aliases;
 /* validate aliases */
 foreach ($aliases as $idx => $alias) {
     $aliasreqdfields = array('aliasdomain' . $idx);
     $aliasreqdfieldsn = array(gettext("Alias Domain"));
     do_input_validation($_POST, $aliasreqdfields, $aliasreqdfieldsn, $input_errors);
     if ($alias['host']) {
         if (!is_hostname($alias['host'])) {
             $input_errors[] = gettext("Hostnames in an alias list can only contain the characters A-Z, 0-9 and '-'. They may not start or end with '-'.");
         } else {
             if (!is_unqualified_hostname($alias['host'])) {
                 $input_errors[] = gettext("A valid alias hostname is specified, but the domain name part should be omitted");
             }
         }
     }
     if ($alias['domain'] && !is_domain($alias['domain'])) {
         $input_errors[] = gettext("A valid domain must be specified in alias list.");
     }
 }
 /* check for overlaps */
 foreach ($a_hosts as $hostent) {
     if (isset($id) && $a_hosts[$id] && $a_hosts[$id] === $hostent) {
         continue;
开发者ID:nmccurdy,项目名称:pfsense,代码行数:31,代码来源:services_unbound_host_edit.php


示例17: is_valid_syslog_server

function is_valid_syslog_server($target)
{
    return is_ipaddr($target) || is_ipaddrwithport($target) || is_hostname($target) || is_hostnamewithport($target);
}
开发者ID:8191,项目名称:opnsense-core,代码行数:4,代码来源:diag_logs_settings.php


示例18: gettext

 if (preg_match('/[ \\/]/', $_POST['name'])) {
     $input_errors[] = gettext("You cannot use spaces or slashes in the 'name' field.");
 }
 if (strlen($_POST['name']) > 16) {
     $input_errors[] = gettext("The 'name' field must be 16 characters or less.");
 }
 switch ($_POST['type']) {
     case 'icmp':
         break;
     case 'tcp':
         break;
     case 'http':
     case 'https':
         if (is_array($pconfig['options'])) {
             if (isset($pconfig['options']['host']) && $pconfig['options']['host'] != "") {
                 if (!is_hostname($pconfig['options']['host'])) {
                     $input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'.");
                 }
             }
             if (isset($pconfig['options']['code']) && $pconfig['options']['code'] != "") {
                 // Check code
                 if (!is_rfc2616_code($pconfig['options']['code'])) {
                     $input_errors[] = gettext("HTTP(s) codes must be from RFC2616.");
                 }
             }
             if (!isset($pconfig['options']['path']) || $pconfig['options']['path'] == "") {
                 $input_errors[] = gettext("The path to monitor must be set.");
             }
         }
         break;
     case 'send':
开发者ID:dariomas,项目名称:pfsense,代码行数:31,代码来源:load_balancer_monitor_edit.php


示例19: foreach

 foreach ($input_addresses as $idx => $input_address) {
     if (is_alias($input_address)) {
         if (!alias_same_type($input_address, $_POST['type'])) {
             // But alias type network can include alias type urltable. Feature#1603.
             if (!($_POST['type'] == 'network' && preg_match("/urltable/i", alias_get_type($input_address)))) {
                 $wrongaliases .= " " . $input_address;
             }
         }
     } else {
         if ($_POST['type'] == "port") {
             if (!is_port($input_address) && !is_portrange($input_address)) {
                 $input_errors[] = $input_address . " " . gettext("is not a valid port or alias.");
             }
         } else {
             if ($_POST['type'] == "host" || $_POST['type'] == "network") {
                 if (is_subnet($input_address) || !is_ipaddr($input_address) && !is_hostname($input_address)) {
                     $input_errors[] = sprintf(gettext('%1$s is not a valid %2$s address, FQDN or alias.'), $input_address, $_POST['type']);
                 }
             }
         }
     }
     $tmpaddress = $input_address;
     if ($_POST['type'] != "host" && is_ipaddr($input_address) && $input_address_subnet[$idx] != "") {
         if (!is_subnet($input_address . "/" . $input_address_subnet[$idx])) {
             $input_errors[] = sprintf(gettext('%s/%s is not a valid subnet.'), $input_address, $input_address_subnet[$idx]);
         } else {
             $tmpaddress .= "/" . $input_address_subnet[$idx];
         }
     }
     $address[] = $tmpaddress;
 }
开发者ID:jefersonJim,项目名称:pfsense,代码行数:31,代码来源:firewall_aliases_edit.php


示例20: gettext

         $input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
     }
     if (!empty($pconfig['pppoe_resetminute']) && (!is_numericint($pconfig['pppoe_resetminute']) || $pconfig['pppoe_resetminute'] < 0 || $pconfig['pppoe_resetminute'] > 59)) {
         $input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
     }
     if (!empty($pconfig['pppoe_resetdate']) && !is_numeric(str_replace("/", "", $pconfig['pppoe_resetdate']))) {
         $input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
     }
 }
 if (!empty($pconfig['localip']) && !is_ipaddrv4($pconfig['localip'])) {
     $input_errors[] = gettext("A valid PPTP local IP address must be specified.");
 }
 if (!empty($pconfig['pptp_subnet']) && !is_numeric($pconfig['pptp_subnet'])) {
     $input_errors[] = gettext("A valid PPTP subnet bit count must be specified.");
 }
 if (!empty($pconfig['pptp_remote']) && !is_ipaddrv4($pconfig['pptp_remote']) && !is_hostname($pconfig['gateway'][$iface])) {
     $input_errors[] = gettext("A valid PPTP remote IP address must be specified.");
 }
 if (!empty($pconfig['pptp_idletimeout']) && !is_numericint($pconfig['pptp_idletimeout'])) {
     $input_errors[] = gettext("The idle timeout value must be an integer.");
 }
 if (!empty($pconfig['spoofmac']) && !is_macaddr($pconfig['spoofmac'])) {
     $input_errors[] = gettext("A valid MAC address must be specified.");
 }
 if (!empty($pconfig['mtu'])) {
     if ($pconfig['mtu'] < 576 || $pconfig['mtu'] > 9000) {
         $input_errors[] = gettext("The MTU must be greater than 576 bytes and less than 9000.");
     }
     if (stristr($a_interfaces[$if]['if'], "_vlan")) {
         $realhwif_array = get_parent_interface($a_interfaces[$if]['if']);
         // Need code to handle MLPPP if we ever use $realhwif for MLPPP handling
开发者ID:paudam,项目名称:opnsense-core,代码行数:31,代码来源:interfaces.php



注:本文中的is_hostname函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_html函数代码示例发布时间:2022-05-15
下一篇:
PHP is_home函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap