当前位置: 首页>>代码示例>>PHP>>正文


PHP is_macaddr函数代码示例

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


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

示例1: preg_match

     preg_match("/\\-\$/", $_POST['hostname'], $matches);
     if ($matches) {
         $input_errors[] = gettext("The hostname cannot end with a hyphen according to RFC952");
     }
     if (!is_hostname($_POST['hostname'])) {
         $input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'.");
     } else {
         if (!is_unqualified_hostname($_POST['hostname'])) {
             $input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted");
         }
     }
 }
 if ($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr'])) {
     $input_errors[] = gettext("A valid IP address must be specified.");
 }
 if ($_POST['mac'] && !is_macaddr($_POST['mac'])) {
     $input_errors[] = gettext("A valid MAC address must be specified.");
 }
 if ($static_arp_enabled && !$_POST['ipaddr']) {
     $input_errors[] = gettext("Static ARP is enabled.  You must specify an IP address.");
 }
 /* check for overlaps */
 foreach ($a_maps as $mapent) {
     if (isset($id) && $a_maps[$id] && $a_maps[$id] === $mapent) {
         continue;
     }
     /* The fully qualified hostname (hostname + '.' + domainname) must be unique.
      * The unqualified hostname does not have to be unique as long as the fully
      * qualified hostname is unique. */
     $existingFqn = "{$mapent['hostname']}.{$mapent['domain']}";
     $candidateFqn = "{$_POST['hostname']}.{$_POST['domain']}";
开发者ID:sjourdois,项目名称:pfsense,代码行数:31,代码来源:services_dhcp_edit.php

示例2: gettext

 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;
     } else {
         $min_mtu = 576;
         $max_mtu = 9000;
     }
     if ($_POST['mtu'] < $min_mtu || $_POST['mtu'] > $max_mtu) {
         $input_errors[] = sprintf(gettext("The MTU must be between %d and %d bytes."), $min_mtu, $max_mtu);
开发者ID:simudream,项目名称:pfsense,代码行数:31,代码来源:interfaces.php

示例3: validate_partial_mac_list

function validate_partial_mac_list($maclist)
{
    $macs = explode(',', $maclist);
    // Loop through and look for invalid MACs.
    foreach ($macs as $mac) {
        if (!is_macaddr($mac, true)) {
            return false;
        }
    }
    return true;
}
开发者ID:karawan,项目名称:core,代码行数:11,代码来源:services_dhcp.php

示例4: unset

    $pconfig['mac'] = $a_passthrumacs[$id]['mac'];
    $pconfig['bw_up'] = $a_passthrumacs[$id]['bw_up'];
    $pconfig['bw_down'] = $a_passthrumacs[$id]['bw_down'];
    $pconfig['descr'] = $a_passthrumacs[$id]['descr'];
    $pconfig['username'] = $a_passthrumacs[$id]['username'];
}
if ($_POST) {
    unset($input_errors);
    $pconfig = $_POST;
    /* input validation */
    $reqdfields = explode(" ", "action mac");
    $reqdfieldsn = array(gettext("Action"), gettext("MAC address"));
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
    $_POST['mac'] = strtolower(str_replace("-", ":", $_POST['mac']));
    if ($_POST['mac']) {
        if (is_macaddr($_POST['mac'])) {
            $iflist = get_interface_list();
            foreach ($iflist as $if) {
                if ($_POST['mac'] == strtolower($if['mac'])) {
                    $input_errors[] = sprintf(gettext("The MAC address %s belongs to a local interface. It cannot be used here."), $_POST['mac']);
                    break;
                }
            }
        } else {
            $input_errors[] = sprintf("%s. [%s]", gettext("A valid MAC address must be specified"), $_POST['mac']);
        }
    }
    if ($_POST['bw_up'] && !is_numeric($_POST['bw_up'])) {
        $input_errors[] = gettext("Upload speed needs to be an integer");
    }
    if ($_POST['bw_down'] && !is_numeric($_POST['bw_down'])) {
开发者ID:KyleJohnstonNet,项目名称:pfsense,代码行数:31,代码来源:services_captiveportal_mac_edit.php

示例5: unset

}
if ($_POST || $_GET['mac']) {
    unset($input_errors);
    if ($_GET['mac']) {
        /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
        $_GET['mac'] = strtolower(str_replace("-", ":", $_GET['mac']));
        $mac = $_GET['mac'];
        $if = $_GET['if'];
    } else {
        /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
        $_POST['mac'] = strtolower(str_replace("-", ":", $_POST['mac']));
        $mac = $_POST['mac'];
        $if = $_POST['interface'];
    }
    /* input validation */
    if (!$mac || !is_macaddr($mac)) {
        $input_errors[] = gettext("A valid MAC address must be specified.");
    }
    if (!$if) {
        $input_errors[] = gettext("A valid interface must be specified.");
    }
    if (!$input_errors) {
        /* determine broadcast address */
        $ipaddr = get_interface_ip($if);
        if (!is_ipaddr($ipaddr)) {
            $input_errors[] = gettext("A valid ip could not be found!");
        } else {
            $bcip = gen_subnet_max($ipaddr, get_interface_subnet($if));
            /* Execute wol command and check return code. */
            if (!mwexec("/usr/local/bin/wol -i {$bcip} " . escapeshellarg($mac))) {
                $savemsg .= sprintf(gettext("Sent magic packet to %s."), $mac);
开发者ID:OptimWIFI,项目名称:pfsense,代码行数:31,代码来源:services_wol.php

示例6: gettext

         $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
         $parent_realhwif = $realhwif_array[0];
         $parent_if = convert_real_interface_to_friendly_interface_name($parent_realhwif);
         if (!empty($parent_if) && !empty($config['interfaces'][$parent_if]['mtu'])) {
             if ($pconfig['mtu'] > intval($config['interfaces'][$parent_if]['mtu'])) {
                 $input_errors[] = gettext("MTU of a vlan should not be bigger than parent interface.");
             }
开发者ID:paudam,项目名称:opnsense-core,代码行数:31,代码来源:interfaces.php


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