本文整理汇总了PHP中get_interface_info函数的典型用法代码示例。如果您正苦于以下问题:PHP get_interface_info函数的具体用法?PHP get_interface_info怎么用?PHP get_interface_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_interface_info函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_configured_interface_with_descr
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<section class="col-xs-12">
<div class="content-box">
<div class="table-responsive">
<table class="table table-striped">
<?php
$i = 0;
$ifdescrs = get_configured_interface_with_descr(false, true);
foreach ($ifdescrs as $ifdescr => $ifname) {
$ifinfo = get_interface_info($ifdescr);
// Load MAC-Manufacturer table
$mac_man = load_mac_manufacturer_table();
?>
<thead>
<tr>
<th colspan="2" class="listtopic">
<?php
echo htmlspecialchars($ifname);
?>
<?php
echo gettext("interface");
?>
(<?php
echo htmlspecialchars($ifdescr);
示例2: get_interfacestatus
function get_interfacestatus()
{
$data = "";
global $config;
//build interface list for widget use
$ifdescrs = get_configured_interface_with_descr();
foreach ($ifdescrs as $ifdescr => $ifname) {
$ifinfo = get_interface_info($ifdescr);
$data .= $ifname . ",";
if ($ifinfo['status'] == "up" || $ifinfo['status'] == "associated") {
$data .= "up";
} else {
if ($ifinfo['status'] == "no carrier") {
$data .= "down";
} else {
if ($ifinfo['status'] == "down") {
$data .= "block";
}
}
}
$data .= ",";
if ($ifinfo['ipaddr']) {
$data .= htmlspecialchars($ifinfo['ipaddr']);
}
$data .= ",";
if ($ifinfo['status'] != "down") {
$data .= htmlspecialchars($ifinfo['media']);
}
$data .= "~";
}
return $data;
}
示例3: array_keys
$keys = array_keys($ifdescrs);
$shown[$keys[0]] = true;
}
if (isset($a_config["refreshinterval"]) && is_numericint($a_config["refreshinterval"])) {
$refreshinterval = $a_config["refreshinterval"];
} else {
$refreshinterval = 10;
}
if (isset($a_config["scale_type"])) {
$scale_type = $a_config["scale_type"];
} else {
$scale_type = "up";
}
$graphcounter = 0;
foreach ($ifdescrs as $ifname => $ifdescr) {
$ifinfo = get_interface_info($ifname);
if ($shown[$ifname]) {
$mingraphbutton = "inline";
$showgraphbutton = "none";
$graphdisplay = "inline";
$interfacevalue = "show";
$graphcounter++;
} else {
$mingraphbutton = "none";
$showgraphbutton = "inline";
$graphdisplay = "none";
$interfacevalue = "hide";
}
if ($ifinfo['status'] != "down") {
?>
<div style="display:<?php
示例4: unset
require "auth.inc";
require "guiconfig.inc";
unset($index);
if (isset($_GET['index']) && $_GET['index']) {
$index = $_GET['index'];
} else {
if (isset($_POST['index']) && $_POST['index']) {
$index = $_POST['index'];
}
}
if (!$index) {
exit;
}
$optcfg =& $config['interfaces']['opt' . $index];
// Get interface informations.
$ifinfo = get_interface_info(get_ifname($optcfg['if']));
if ($config['interfaces']['opt' . $index]['ipaddr'] == "dhcp") {
$pconfig['type'] = "DHCP";
$pconfig['ipaddr'] = get_ipaddr($optcfg['if']);
$pconfig['subnet'] = get_subnet_bits($optcfg['if']);
} else {
$pconfig['type'] = "Static";
$pconfig['ipaddr'] = $optcfg['ipaddr'];
$pconfig['subnet'] = $optcfg['subnet'];
}
$pconfig['ipv6_enable'] = isset($optcfg['ipv6_enable']);
if ($config['interfaces']['opt' . $index]['ipv6addr'] == "auto") {
$pconfig['ipv6type'] = "Auto";
$pconfig['ipv6addr'] = get_ipv6addr($optcfg['if']);
} else {
$pconfig['ipv6type'] = "Static";
示例5: array
</div><br><br>
<div id="monitorIpNote" style="float: none;">Bilgi: Bazı ağlarda ping kapalı olabilir.</div>
</td>
</tr>
<tr align="left">
<td width="22%" valign="top" class="vncellreq"><div id="interfacename_text"></div></td>
<td width="78%" class="vtable" colspan="2">
<input name="ipaddr" type="text" size="16" style="float: left;">
<select id="iface" name="iface" style="float: left; display: none;">
<?php
$interfaces = array('wan' => 'WAN', 'lan' => 'LAN');
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
$interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
}
foreach ($interfaces as $iface => $ifacename) {
$ifinfo = get_interface_info($iface);
if (isset($ifinfo['gateway'])) {
?>
<option value="<?php
echo $iface;
?>
"><?php
echo htmlspecialchars($ifacename);
?>
</option>
<?php
}
}
?>
</select>
<input class="formbtn" type="button" name="button1" value="Pool Ekle" onclick="AddServerToPool(document.iform);"><br>
示例6: get_interfaces_stats
function get_interfaces_stats()
{
global $g;
global $config;
$ifstatus = array();
$i = 0;
$ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN');
for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
$ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
}
foreach ($ifdescrs as $ifdescr => $ifname) {
$ifinfo = get_interface_info($ifdescr);
if ($ifinfo['status'] == "up") {
$online = "Up";
} else {
$online = "Down";
}
if (!empty($ifinfo['ipaddr'])) {
$ip = htmlspecialchars($ifinfo['ipaddr']);
} else {
$ip = "-";
}
$ifstatus[] = htmlspecialchars($ifname) . " [{$online}]";
}
$status = " " . implode(", ", $ifstatus);
return $status;
}
示例7: session_start
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
session_start();
// Make sure no other output than the requested data is echoed.
if (0 == strcmp("cpu=", getenv("QUERY_STRING"))) {
/* leave it as is to avoid side effects (only an additional "=")*/
$cpuload = @system_get_cpu_usage();
echo $cpuload;
} else {
$param = $_GET;
if (isset($param['if'])) {
$ifinfo = @get_interface_info($param['if']);
$time = gettimeofday();
$timing = (double) $time["sec"] + (double) $time["usec"] / 1000000.0;
echo "{$timing}|" . $ifinfo['inbytes'] . "|" . $ifinfo['outbytes'] . "\n";
} else {
if (isset($param['cpu'])) {
if ($param['cpu'] == 0) {
$_SESSION['cpu'] = @system_get_smp_cpu_usage();
}
echo $_SESSION['cpu'][$param['cpu']];
}
}
}
示例8: DAMAGES
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
require "auth.inc";
require "guiconfig.inc";
// Make sure no other output than the requested data is echoed.
if (0 == strcmp("cpu", getenv(QUERY_STRING))) {
$cpuload = @system_get_cpu_usage();
echo $cpuload;
} else {
$if = $_GET['if'];
$ifinfo = @get_interface_info($if);
$time = gettimeofday();
$timing = (double) $time["sec"] + (double) $time["usec"] / 1000000.0;
echo "{$timing}|" . $ifinfo['inbytes'] . "|" . $ifinfo['outbytes'] . "\n";
}