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


PHP gen_subnet_mask_long函数代码示例

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


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

示例1: gettext

										</td>
										</tr>
										<tr>
										<td width="22%" valign="top" class="vncellreq"><?php 
    echo gettext("Available range");
    ?>
</td>
										<td width="78%" class="vtable">
										<?php 
    $range_from = ip2long(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
    $range_from++;
    echo long2ip32($range_from);
    ?>
										-
										<?php 
    $range_to = ip2long(long2ip32(ip2long($ifcfgip) | ~gen_subnet_mask_long($ifcfgsn)));
    $range_to--;
    echo long2ip32($range_to);
    ?>
										<?php 
    if (is_numeric($pool) || $act == "newpool") {
        ?>
											<br />In-use DHCP Pool Ranges:
											<?php 
        if (is_array($config['dhcpd'][$if]['range'])) {
            ?>
												<br /><?php 
            echo $config['dhcpd'][$if]['range']['from'];
            ?>
-<?php 
            echo $config['dhcpd'][$if]['range']['to'];
开发者ID:karawan,项目名称:core,代码行数:31,代码来源:services_dhcp.php

示例2: ip2ulong

                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 if (!$input_errors) {
     /* make sure the range lies within the current subnet */
     $subnet_start = ip2ulong(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
     $subnet_end = ip2ulong(long2ip32(ip2long($ifcfgip) | ~gen_subnet_mask_long($ifcfgsn)));
     if (ip2ulong($_POST['range_from']) > ip2ulong($_POST['range_to'])) {
         $input_errors[] = gettext("The range is invalid (first element higher than second element).");
     }
     if (ip2ulong($_POST['range_from']) < $subnet_start || ip2ulong($_POST['range_to']) > $subnet_end) {
         $input_errors[] = gettext("The specified range lies outside of the current subnet.");
     }
     if (is_numeric($pool) || $act == "newpool") {
         if (!(ip2ulong($_POST['range_from']) > ip2ulong($config['dhcpd'][$if]['range']['to']) || ip2ulong($_POST['range_to']) < ip2ulong($config['dhcpd'][$if]['range']['from']))) {
             $input_errors[] = gettext("The specified range must not be within the DHCP range for this interface.");
         }
     }
     foreach ($a_pools as $id => $p) {
         if (is_numeric($pool) && $id == $pool) {
             continue;
         }
开发者ID:nwholloway,项目名称:pfsense,代码行数:31,代码来源:services_dhcp.php

示例3: ip2long

 if ($_POST['range_from'] && !is_ipaddr($_POST['range_from'])) {
     $input_errors[] = "Geçerli bir aralıkta tanımlanmalıdır.";
 }
 if ($_POST['range_to'] && !is_ipaddr($_POST['range_to'])) {
     $input_errors[] = "Geçerli bir aralıkta tanımlanmalıdır.";
 }
 if ($_POST['gateway'] && !is_ipaddr($_POST['gateway'])) {
     $input_errors[] = "Geçerli bir IP gateway IP adresi tanımlanmaldır.";
 }
 /* make sure the range lies within the bridged subnet */
 if ($_POST['bridge']) {
     if ($_POST['method'] == "ovpn") {
         $ipaddr = $config['interfaces'][$_POST['bridge']]['ipaddr'];
         $subnet = $config['interfaces'][$_POST['bridge']]['subnet'];
         $subnet_start = ip2long($ipaddr) & gen_subnet_mask_long($subnet);
         $subnet_end = ip2long($ipaddr) | ~gen_subnet_mask_long($subnet);
         if (!ip_in_subnet($_POST['gateway'], gen_subnet($ipaddr, $subnet) . "/" . $subnet)) {
             $input_errors[] = "The specified gateway lies outside of the bridged subnet.";
         }
         if (ip2long($_POST['range_from']) < $subnet_start || ip2long($_POST['range_from']) > $subnet_end || ip2long($_POST['range_to']) < $subnet_start || ip2long($_POST['range_to']) > $subnet_end) {
             $input_errors[] = "The specified range lies outside of the bridged subnet.";
         }
         if (ip2long($_POST['range_from']) > ip2long($_POST['range_to'])) {
             $input_errors[] = "The range is invalid (first element higher than second element).";
         }
     }
 }
 /* valid Port */
 if (empty($_POST['port'])) {
     $input_errors[] = "You must provide a server in between 1 and 65535.";
 } else {
开发者ID:rootsghost,项目名称:5651-pfsense,代码行数:31,代码来源:vpn_openvpn_srv_edit.php

示例4: gen_subnet_mask

                          maskesi</td>
                        <td width="78%" class="vtable">
                          <?php 
echo gen_subnet_mask($ifcfg['subnet']);
?>
                        </td>
                      </tr>
                      <tr>
                        <td width="22%" valign="top" class="vncellreq">Mevcut aralık</td>
                        <td width="78%" class="vtable">
                          <?php 
echo long2ip(ip2long($ifcfg['ipaddr']) & gen_subnet_mask_long($ifcfg['subnet']));
?>
                          -
                          <?php 
echo long2ip(ip2long($ifcfg['ipaddr']) | ~gen_subnet_mask_long($ifcfg['subnet']));
?>
                        </td>
                      </tr>
					  <?php 
if ($is_olsr_enabled) {
    ?>
                      <tr>
                        <td width="22%" valign="top" class="vncellreq">Alt ağ maskesi</td>
                        <td width="78%" class="vtable">
	                        <select name="netmask" class="formfld" id="netmask">
							<?php 
    for ($i = 32; $i > 0; $i--) {
        if ($i != 31) {
            echo "<option value=\"{$i}\" ";
            if ($i == $pconfig['netmask']) {
开发者ID:rootsghost,项目名称:5651-pfsense,代码行数:31,代码来源:services_dhcp.php

示例5: foreach

 /* check for overlaps */
 foreach ($a_maps as $mapent) {
     if (isset($id) && $a_maps[$id] && $a_maps[$id] === $mapent) {
         continue;
     }
     if ($mapent['hostname'] == $_POST['hostname'] && $mapent['hostname'] || $mapent['mac'] == $_POST['mac']) {
         $input_errors[] = "This Hostname, IP or MAC address already exists.";
         break;
     }
 }
 /* make sure it's not within the dynamic subnet */
 if ($_POST['ipaddr']) {
     $dynsubnet_start = ip2long($config['dhcpd'][$if]['range']['from']);
     $dynsubnet_end = ip2long($config['dhcpd'][$if]['range']['to']);
     $lansubnet_start = ip2long($ifcfg['ipaddr']) & gen_subnet_mask_long($ifcfg['subnet']);
     $lansubnet_end = ip2long($ifcfg['ipaddr']) | ~gen_subnet_mask_long($ifcfg['subnet']);
     if (ip2long($_POST['ipaddr']) < $lansubnet_start || ip2long($_POST['ipaddr']) > $lansubnet_end) {
         $input_errors[] = "The IP address must lie in the {$ifcfg['descr']} subnet.";
     }
 }
 if (!$input_errors) {
     $mapent = array();
     $mapent['mac'] = $_POST['mac'];
     $mapent['ipaddr'] = $_POST['ipaddr'];
     $mapent['hostname'] = $_POST['hostname'];
     $mapent['descr'] = $_POST['descr'];
     if (isset($id) && $a_maps[$id]) {
         $a_maps[$id] = $mapent;
     } else {
         $a_maps[] = $mapent;
     }
开发者ID:rootsghost,项目名称:5651-pfsense,代码行数:31,代码来源:services_dhcp_edit.php


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