本文整理匯總了PHP中DbFreeResult函數的典型用法代碼示例。如果您正苦於以下問題:PHP DbFreeResult函數的具體用法?PHP DbFreeResult怎麽用?PHP DbFreeResult使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DbFreeResult函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: elseif
echo "<tr bgcolor=#{$bg2}><td>{$row} IF changes in total</td></tr></table>\n";
echo '</td></tr></table>';
include_once "inc/footer.php";
} elseif ($wol) {
if (preg_match("/dsk/", $_SESSION['group'])) {
$link = @DbConnect($dbhost, $dbuser, $dbpass, $dbname);
$query = GenQuery('nodes', 's', '*', '', '', array('mac'), array('='), array($wol));
$res = @DbQuery($query, $link);
$nnod = @DbNumRows($res);
if ($nnod != 1) {
echo "<h4>{$wol} {$n1rmsg}</h4>";
@DbFreeResult($res);
die;
} else {
$n = @DbFetchRow($res);
@DbFreeResult($res);
$ip = long2ip($n[1]);
}
wake($ip, $wol, 9);
} else {
echo $nokmsg;
}
?>
<h5>Magic Packet sent to <?php
echo $ip;
?>
</h5>
<script language="JavaScript"><!--
setTimeout("history.go(-1)",10000);
//--></script>
<?php
示例2: TopoTable
function TopoTable($reg = "", $cty = "", $bld = "", $flr = "", $rom = "", $nsd = 0)
{
global $link, $dev, $noloc, $alarr, $dreg, $dcity, $dbuild, $locsep, $now, $retire;
if ($nsd) {
$query = GenQuery('devices', 's', '*', '', '', array('location'), array('like'), array(TopoLoc($reg, $cty, $bld, $flr, $rom)));
} else {
$query = GenQuery('devices', 's', '*', '', '', array('snmpversion', 'location'), array('>', 'like'), array('0', TopoLoc($reg, $cty, $bld, $flr, $rom)), array('AND'));
}
$res = DbQuery($query, $link);
if ($res) {
while ($d = DbFetchRow($res)) {
$mn = array_key_exists($d[0], $alarr) ? 1 : 0;
if (preg_match("/.+{$locsep}.+{$locsep}.+/", $d[10])) {
$l = explode($locsep, $d[10]);
if ($mn) {
$dreg[$l[0]]['mn']++;
$dreg[$l[0]]['al'] += $alarr[$d[0]]['st'];
$dcity[$l[0]][$l[1]]['mn']++;
$dcity[$l[0]][$l[1]]['al'] += $alarr[$d[0]]['st'];
$dbuild[$l[0]][$l[1]][$l[2]]['mn']++;
$dbuild[$l[0]][$l[1]][$l[2]]['al'] += $alarr[$d[0]]['st'];
}
$dreg[$l[0]]['nd']++;
$dcity[$l[0]][$l[1]]['nd']++;
$dbuild[$l[0]][$l[1]][$l[2]]['nd']++;
if ($d[6] > 3) {
$dbuild[$l[0]][$l[1]][$l[2]]['nr']++;
}
if ($reg and $cty) {
$dev[$l[3]][$l[4]][$d[0]]['rk'] = $l[5];
$dev[$l[3]][$l[4]][$d[0]]['ru'] = $l[6];
$dev[$l[3]][$l[4]][$d[0]]['ip'] = long2ip($d[1]);
$dev[$l[3]][$l[4]][$d[0]]['ty'] = $d[3];
$dev[$l[3]][$l[4]][$d[0]]['co'] = $d[11];
$dev[$l[3]][$l[4]][$d[0]]['po'] = $d[16];
$dev[$l[3]][$l[4]][$d[0]]['ic'] = $d[18];
$dev[$l[3]][$l[4]][$d[0]]['mn'] = $mn;
$dev[$l[3]][$l[4]][$d[0]]['al'] = $alarr[$d[0]]['st'];
$dev[$l[3]][$l[4]][$d[0]]['sz'] = $d[28];
$dev[$l[3]][$l[4]][$d[0]]['sk'] = $d[29] ? $d[29] : 1;
}
} else {
$noloc[$d[0]]['ip'] = long2ip($d[1]);
$noloc[$d[0]]['ty'] = $d[3];
$noloc[$d[0]]['lo'] = $d[10];
$noloc[$d[0]]['co'] = $d[11];
$noloc[$d[0]]['po'] = $d[16];
$noloc[$d[0]]['ic'] = $d[18];
$noloc[$d[0]]['mn'] = $mn;
if ($mn) {
$noloc[$d[0]]['al'] = $alarr[$d[0]]['st'];
}
}
}
DbFreeResult($res);
} else {
print DbError($link);
}
}
示例3: Query
@DbFreeResult($radres);
} else {
print @DbError($radlink);
}
// get online status on these users
for ($i = 0; $i < $nres; $i++) {
$radquery = Query('radacct', '*', 'UserName', '=', $radusr[$i]["UserName"], 'AND', 'AcctStopTime', '=', '0', $_GET[ord], '');
$radres = @DbQuery($radquery, $radlink);
if ($u = @DbFetchArray($radres)) {
$radusr[$i]["Online"] = true;
$radusr[$i]["NAS"] = $u['NASIPAddress'];
} else {
$radusr[$i]["Online"] = false;
$radusr[$i]["NAS"] = '';
}
@DbFreeResult($radres);
}
// print
for ($i = 0; $i < $nres; $i++) {
if ($row == "1") {
$row = "0";
$bg = $bga;
$bi = $bia;
} else {
$row = "1";
$bg = $bgb;
$bi = $bib;
}
$si = ord(substr(strtolower($radusr[$i]["UserName"]), 0, 1)) + ord(substr(strtolower($radusr[$i]["UserName"]), 1, 1)) + ord(substr(strtolower($radusr[$i]["UserName"]), 2, 1)) - 291;
if ($si < 1 or $si > 70) {
$si = "36";
示例4: Read
function Read($ina, $filter)
{
global $link, $locsep, $resmsg;
global $lev, $ipi, $net, $dev, $ndev, $bdev, $cdev, $rdev;
global $devlink, $ctylink, $bldlink;
global $nctylink, $nbldlink, $actylink, $abldlink;
$net = array();
if ($ina == "vlan") {
$query = GenQuery('vlans', 'g', 'device', 'device', '', array('vlanid'), array('regexp'), array($filter));
$res = @DbQuery($query, $link);
if ($res) {
while ($vl = @DbFetchRow($res)) {
$devs[] = preg_replace('/([\\^\\$+])/', '\\\\\\\\$1', $vl[0]);
# \Q...\E Doesn't seem to work in MySQL?
}
@DbFreeResult($res);
} else {
echo @DbError($link);
}
if (!is_array($devs)) {
echo $resmsg;
die;
}
$query = GenQuery('devices', 's', 'name,ip,location,icon', '', '', array('name'), array('regexp'), array(implode("|", $devs)));
} elseif ($ina == "network") {
$query = GenQuery('networks', 'g', 'device', 'device', '', array('ip'), array('='), array($filter));
$res = @DbQuery($query, $link);
if ($res) {
while ($net = @DbFetchRow($res)) {
$devs[] = preg_replace('/([\\^\\$\\*\\+])/', '\\\\\\\\$1', $net[0]);
}
@DbFreeResult($res);
} else {
echo @DbError($link);
}
if (!is_array($devs)) {
echo $resmsg;
die;
}
$query = GenQuery('devices', 's', 'name,ip,location,icon', '', '', array('name'), array('regexp'), array(implode("|", $devs)));
} elseif ($ina == "type") {
$query = GenQuery('devices', 's', 'name,ip,location,icon', '', '', array('type'), array('regexp'), array($filter));
} else {
$query = GenQuery('devices', 's', 'name,ip,location,icon', '', '', array('location'), array('regexp'), array($filter));
}
$res = @DbQuery($query, $link);
if ($res) {
while ($unit = @DbFetchRow($res)) {
$l = explode($locsep, $unit[2]);
$ndev["{$l['0']}{$locsep}{$l['1']}"][$l[2]][$l[3]][] = $unit[0];
$bdev["{$l['0']}{$locsep}{$l['1']}"][$l[2]]++;
$cdev["{$l['0']}{$locsep}{$l['1']}"]++;
$rdev[$l[0]][$l[1]]++;
$dev[$unit[0]]['ip'] = long2ip($unit[1]);
$dev[$unit[0]]['ic'] = $unit[3];
$dev[$unit[0]]['cty'] = "{$l['0']}{$locsep}{$l['1']}";
$dev[$unit[0]]['bld'] = $l[2];
$dev[$unit[0]]['rom'] = $l[4];
}
@DbFreeResult($res);
} else {
echo @DbError($link);
}
if ($ipi) {
$query = GenQuery('networks');
$res = @DbQuery($query, $link);
if ($res) {
while ($n = @DbFetchRow($res)) {
$net[$n[0]][$n[1]] .= " " . long2ip($n[2]);
}
} else {
echo @DbError($link);
}
@DbFreeResult($res);
}
$query = GenQuery('links');
$res = @DbQuery($query, $link);
if ($res) {
while ($l = @DbFetchRow($res)) {
if ($dev[$l[1]]['ic'] and $dev[$l[3]]['ic']) {
# both ends are ok, if an icon exists
if ($lev == "f") {
if (isset($devlink[$l[3]][$l[1]])) {
# opposite link doesn't exist?
$devlink[$l[3]][$l[1]]['nbw'][$l[3]][$l[4]][$l[1]][$l[2]] = $l[5];
} else {
$devlink[$l[1]][$l[3]]['bw'][$l[1]][$l[2]][$l[3]][$l[4]] = $l[5];
}
}
if ($dev[$l[1]]['bld'] != $dev[$l[3]]['bld']) {
# is it same bld?
$nbldlink[$dev[$l[1]]['bld']]++;
$abldlink[$dev[$l[1]]['bld']][$dev[$l[3]]['bld']]++;
# needed for Arranging.
if (isset($bldlink[$dev[$l[3]]['bld']][$dev[$l[1]]['bld']])) {
# link defined already?
$bldlink[$dev[$l[3]]['bld']][$dev[$l[1]]['bld']]['nbw'][$l[3]][$l[4]][$l[1]][$l[2]] = $l[5];
} else {
$bldlink[$dev[$l[1]]['bld']][$dev[$l[3]]['bld']]['bw'][$l[1]][$l[2]][$l[3]][$l[4]] = $l[5];
}
//.........這裏部分代碼省略.........
示例5: Layout
function Layout() {
global $link,$locsep,$resmsg;
global $xm,$ym,$xo,$yo,$len,$geo,$ina,$flt,$lev,$ipi;
global $mapbg,$rloc,$cloc,$bloc;
$net = array();
# Gather Device Info
if($ina == "vlan"){
$query = GenQuery('vlans','g','device','device','',array('vlanid'),array('regexp'),array($flt));
$res = @DbQuery($query,$link);
if($res){
while( ($vl = @DbFetchRow($res)) ){
$devs[] = preg_replace('/([\^\$+])/','\\\\\\\\$1',$vl[0]); # \Q...\E Doesn't seem to work in MySQL?
}
@DbFreeResult($res);
}else{
echo @DbError($link);
}
if (! is_array ($devs) ){echo $resmsg;die;}
$query = GenQuery('devices','s','name,ip,location,icon','','',array('name'),array('regexp'),array(implode("|",$devs)));
}elseif($ina == "network"){
$query = GenQuery('networks','g','device','device','',array('ip'),array('='),array($flt));
$res = @DbQuery($query,$link);
if($res){
while( ($net = @DbFetchRow($res)) ){
$devs[] = preg_replace('/([\^\$\*\+])/','\\\\\\\\$1',$net[0]);
}
@DbFreeResult($res);
}else{
echo @DbError($link);
}
if (! is_array ($devs) ){echo $resmsg;die;}
$query = GenQuery('devices','s','name,ip,location,icon','','',array('name'),array('regexp'),array(implode("|",$devs)));
}elseif($ina == "type"){
$query = GenQuery('devices','s','name,ip,location,icon','','',array('type'),array('regexp'),array($flt));
}else{
$query = GenQuery('devices','s','name,ip,location,icon','','',array('location'),array('regexp'),array($flt));
}
$res = @DbQuery($query,$link);
if($res){
while( ($d = @DbFetchRow($res)) ){
$l = explode($locsep, $d[2]);
if($lev == "c" or $lev == "C"){
$locs[$l[0]][$l[1]]++;
}elseif($lev == "b" or $lev == "B"){
$locs[$l[0]][$l[1]][$l[2]]++;
}else{
$locs[$l[0]][$l[1]][$l[2]][$l[3]][] = $d[0];
}
$dev['ip'] [$d[0]] = long2ip($d[1]);
$dev['ic'] [$d[0]] = $d[3];
$dev['reg'][$d[0]] = $l[0];
$dev['cty'][$d[0]] = $l[1];
$dev['bld'][$d[0]] = $l[2];
$dev['rom'][$d[0]] = $l[4];
}
@DbFreeResult($res);
}else{
echo @DbError($link);
}
if($ipi){
$query = GenQuery('networks');
$res = @DbQuery($query,$link);
if($res){
while( ($n = @DbFetchRow($res)) ){
$net[$n[0]][$n[1]] .= " ". long2ip($n[2]);
}
}else{
echo @DbError($link);
}
@DbFreeResult($res);
}
# Gather Link Info
$query = GenQuery('links');
$res = @DbQuery($query,$link);
if($res){
while( ($l = @DbFetchRow($res)) ){
if($dev[$l[1]]['ic'] and $dev[$l[3]]['ic']){ # both ends are ok, if an icon exists
if($lev == "f"){
if( isset($devlink[$l[3]][$l[1]]) ){ # opposite link doesn't exist?
$devlink[$l[3]][$l[1]]['nbw'][$l[3]][$l[4]][$l[1]][$l[2]] = $l[5];
}else{
$devlink[$l[1]][$l[3]]['bw'][$l[1]][$l[2]][$l[3]][$l[4]] = $l[5];
}
}
if($dev[$l[1]]['bld'] != $dev[$l[3]]['bld']) { # is it same bld?
$nbldlink[$dev[$l[1]]['bld']] ++;
$abldlink[$dev[$l[1]]['bld']][$dev[$l[3]]['bld']]++; # needed for Arranging.
if(isset($bldlink[$dev[$l[3]]['bld']][$dev[$l[1]]['bld']]) ){ # link defined already?
$bldlink[$dev[$l[3]]['bld']][$dev[$l[1]]['bld']]['nbw'][$l[3]][$l[4]][$l[1]][$l[2]] = $l[5];
}else{
$bldlink[$dev[$l[1]]['bld']][$dev[$l[3]]['bld']]['bw'][$l[1]][$l[2]][$l[3]][$l[4]] = $l[5];
}
}
if($dev[$l[1]]['cty'] != $dev[$l[3]]['cty']){ # is it same cty?
$nctylink[$dev[$l[1]]['cty']]++;
$actylink[$dev[$l[1]]['cty']][$dev[$l[3]]['cty']]++; # needed for Arranging.
//.........這裏部分代碼省略.........
示例6: Map
function Map()
{
global $debug, $link, $locsep, $vallbl, $sholbl, $sumlbl, $imas, $fmt, $lit, $fsz, $pos;
global $xm, $ym, $xo, $yo, $rot, $cro, $bro, $len, $lsf, $mde, $in, $op, $st, $co, $lev, $loo, $loa, $loi, $ipi, $ifa;
global $mapbg, $mapitems, $maplinks, $mapinfo, $imgmap, $reg, $cty, $bld, $flr, $dev, $nod, $nlnk, $jnod, $cud;
$rlnk = array();
$clnk = array();
$blnk = array();
$dlnk = array();
$acol = '';
$join = '';
if ($pos == 'a') {
$acol = ',status';
$join .= 'LEFT JOIN monitoring USING (device) ';
}
if (in_array('vlanid', $in) or in_array('vlanname', $in)) {
$join .= 'LEFT JOIN vlans USING (device) ';
}
if (in_array('mac', $in) or in_array('nodip', $in) or in_array('name', $in) or in_array('oui', $in)) {
$join .= 'LEFT JOIN nodes USING (device) ';
}
if (in_array('ifip', $in) or in_array('vrfname', $in)) {
$join .= 'LEFT JOIN networks USING (device) ';
}
if (in_array('neighbor', $in)) {
$join .= 'LEFT JOIN links USING (device) ';
}
$query .= GenQuery('devices', 's', "distinct device,devip,type,location,contact,devmode,icon,cpu,temp,devopts,size,stack{$acol},snmpversion", '', '', $in, $op, $st, $co, $join);
# Postgres requires ordercolumn (snmpversion)!
if ($lev < 5) {
if (strpos($query, 'WHERE')) {
$query .= ' AND snmpversion != 0';
} else {
$query .= ' WHERE snmpversion != 0';
}
}
$query .= ' order by snmpversion desc';
$res = DbQuery($query, $link);
if ($res) {
while ($d = DbFetchRow($res)) {
$l = explode($locsep, $d[3]);
$reg[$l[0]]['ndv']++;
$cty[$l[0]][$l[1]]['ndv']++;
$dev[$d[0]]['reg'] = $l[0];
if ($d[6] and $ipi) {
# Get IP info for interfaces on snmpdevs
$nquery = GenQuery('networks', 's', 'ifname,ifip,ifip6,vrfname', '', '', array('device'), array('='), array($d[0]));
$nres = DbQuery($nquery, $link);
if ($nres) {
while ($n = DbFetchRow($nres)) {
if ($n[1]) {
$dev[$d[0]]['ifip'][$n[0]] .= " " . long2ip($n[1]) . ($n[3] ? " ({$n['3']})" : "");
} else {
$dev[$d[0]]['ifip'][$n[0]] .= " " . DbIPv6($n[2]) . ($n[3] ? " ({$n['3']})" : "");
}
}
} else {
echo DbError($nlink);
}
DbFreeResult($nres);
}
if ($d[6] and ($ifa or $lit == 'l')) {
# Get IF alias TODO use iftype to determine links?
$nquery = GenQuery('interfaces', 's', 'ifname,ifidx,iftype,alias,dinoct,doutoct', '', '', array('device'), array('='), array($d[0]));
$nres = DbQuery($nquery, $link);
if ($nres) {
while ($n = DbFetchRow($nres)) {
$dev[$d[0]]['ifty'][$n[0]] = $n[1];
$dev[$d[0]]['ifix'][$n[0]] = $n[2];
$dev[$d[0]]['ifal'][$n[0]] = $n[3];
$dev[$d[0]]['ifin'][$n[0]] = $n[4];
$dev[$d[0]]['ifout'][$n[0]] = $n[5];
}
} else {
echo DbError($nlink);
}
DbFreeResult($nres);
}
if ($lev > 1) {
$dev[$d[0]]['cty'] = $l[1];
}
if ($lev > 2) {
$bld[$l[0]][$l[1]][$l[2]]['ndv']++;
$dev[$d[0]]['bld'] = $l[2];
}
if ($lev > 3) {
if ($mde == "r") {
$flr[$l[0]][$l[1]][$l[2]][$d[0]]['ndv']++;
} else {
$flr[$l[0]][$l[1]][$l[2]][$l[3]][] = $d[0];
}
$dev[$d[0]]['ip'] = long2ip($d[1]);
$dev[$d[0]]['rom'] = $l[4];
$dev[$d[0]]['rak'] = $l[5] ? $l[5] : "";
$dev[$d[0]]['typ'] = $d[2];
$dev[$d[0]]['con'] = $d[4];
$dev[$d[0]]['mod'] = Devmode($d[5]);
$dev[$d[0]]['ico'] = $d[6];
if (substr($d[9], 1, 1) == "C") {
$dev[$d[0]]['cpu'] = $d[7];
//.........這裏部分代碼省略.........
示例7: Read
function Read($ina, $filter)
{
global $link, $locsep, $fpos, $bpos, $cpos, $rpos, $resmsg;
global $lev, $ipi, $net, $dev, $ndev, $bdev, $fdev;
global $devlink, $ctylink, $bldlink;
global $nctylink, $nbldlink, $actylink, $abldlink;
$net = array();
if ($ina == "vlan") {
$query = GenQuery('vlans', 's', '*', '', '', array('vlanid'), array('regexp'), array($filter));
$res = @DbQuery($query, $link);
if ($res) {
while ($vl = @DbFetchRow($res)) {
$devs[] = preg_replace('/([\\^\\$+])/', '\\\\\\\\$1', $vl[0]);
}
@DbFreeResult($res);
} else {
print @DbError($link);
}
if (!is_array($devs)) {
echo $resmsg;
die;
}
$query = GenQuery('devices', 's', '*', '', '', array('name'), array('regexp'), array(implode("|", $devs)));
} elseif ($ina == "network") {
$query = GenQuery('networks', 's', '*', '', '', array('ip'), array('='), array($filter));
$res = @DbQuery($query, $link);
if ($res) {
while ($vl = @DbFetchRow($res)) {
$devs[] = preg_replace('/([\\^\\$\\*\\+])/', '\\\\\\\\$1', $vl[0]);
}
@DbFreeResult($res);
} else {
print @DbError($link);
}
if (!is_array($devs)) {
echo $resmsg;
die;
}
$query = GenQuery('devices', 's', '*', '', '', array('name'), array('regexp'), array(implode("|", $devs)));
} else {
$query = GenQuery('devices', 's', '*', '', '', array('location'), array('regexp'), array($filter));
}
$res = @DbQuery($query, $link);
if ($res) {
while ($unit = @DbFetchRow($res)) {
$locitems = explode($locsep, $unit[10]);
if ($cpos === false) {
$cty = "-";
} else {
$cty = $locitems[$cpos];
}
if ($bpos === false) {
$bld = "-";
} else {
$bld = $locitems[$bpos];
}
if ($fpos === false) {
$flr = "-";
} else {
$flr = $locitems[$fpos];
}
if ($rpos === false) {
$rom = "-";
} else {
$rom = $locitems[$rpos];
}
$dev[$unit[0]]['ip'] = long2ip($unit[1]);
$dev[$unit[0]]['ic'] = $unit[18];
$dev[$unit[0]]['cty'] = $cty;
$dev[$unit[0]]['bld'] = $bld;
$dev[$unit[0]]['flr'] = $flr;
$dev[$unit[0]]['rom'] = $rom;
$ndev[$cty][$bld][$flr][] = $unit[0];
$bdev[$cty][$bld]++;
$fdev[$cty][$bld][$flr]++;
}
@DbFreeResult($res);
} else {
print @DbError($link);
}
if ($ipi) {
$query = GenQuery('networks');
$res = @DbQuery($query, $link);
if ($res) {
while ($n = @DbFetchRow($res)) {
$net[$n[0]][$n[1]] .= " " . long2ip($n[2]);
}
} else {
print @DbError($link);
}
@DbFreeResult($res);
}
$query = GenQuery('links');
$res = @DbQuery($query, $link);
if ($res) {
while ($l = @DbFetchRow($res)) {
if ($dev[$l[1]]['ic'] and $dev[$l[3]]['ic']) {
// both ends are ok, if an icon exists
if ($lev == "f") {
if (isset($devlink[$l[3]][$l[1]])) {
//.........這裏部分代碼省略.........
示例8: NetPop
function NetPop($ina, $opa, $sta, $lim, $ord)
{
global $link, $modgroup, $self, $verb1, $netlbl, $dislbl, $adrlbl, $poplbl, $agelbl, $tim, $totlbl, $srtlbl;
if ($ina == "devip") {
$ina = "ifip";
}
if ($ord) {
$ocol = "device";
$srt = "{$srtlbl}: Device";
} else {
$ocol = "ifip";
$srt = "{$srtlbl}: IP {$adrlbl}";
}
$query = GenQuery('networks', 's', 'networks.*,lastdis', $ocol, '', array('ifip', $ina), array('>', $opa), array('0', $sta), array('AND'), 'LEFT JOIN devices USING (device)');
$res = DbQuery($query, $link);
if ($res) {
$row = 0;
$netok = array();
while ($n = DbFetchRow($res)) {
$n[2] = ip2long(long2ip($n[2]));
# Hack to fix signing issue for 32bit vars in PHP!
$dmsk = 4294967295.0 << 32 - $n[4];
$dnet = long2ip($n[2] & $dmsk);
if ($n[4] > 16 and $n[4] < 32) {
# Only > /16 but not /32 networks
if (!array_key_exists($dnet, $netok)) {
# Only if subnet hasn't been processed
$netok[$dnet] = 1;
$nod[$dnet] = array();
$nquery = GenQuery('nodes', 's', 'name,inet_ntoa(nodip)', 'nodip', '', array("nodip & {$dmsk}"), array('='), array(sprintf("%u", $n[2] & $dmsk)));
$nres = DbQuery($nquery, $link);
if ($nres) {
while ($no = DbFetchRow($nres)) {
$nod[$dnet][$no[1]] = $no[0];
}
}
DbFreeResult($nres);
}
$n[2] = long2ip($n[2]);
$dev[$dnet][$n[2]] = $n[0];
$nets[$dnet] = $n[4];
if (count(array_keys($nets)) == $lim) {
break;
}
}
}
DbFreeResult($res);
if ($nets) {
?>
<h2><?php
echo $netlbl;
?>
<?php
echo $poplbl;
?>
</h2>
<table class="content"><tr class="<?php
echo $modgroup[$self];
?>
2">
<th colspan="2"><img src="img/16/net.png"><br>IP <?php
echo $adrlbl;
?>
</th>
<th><img src="img/16/nods.png"><br><?php
echo $poplbl;
?>
</th>
</tr>
<?php
$row = 0;
foreach (array_keys($nets) as $net) {
if ($row % 2) {
$bg = "txta";
$bi = "imga";
} else {
$bg = "txtb";
$bi = "imgb";
}
$row++;
list($ntimg, $ntit) = Nettype($net);
echo "<tr class=\"{$bg}\">\n";
echo "<th class=\"{$bi}\" width=\"20\"><img src=\"img/{$ntimg}\" title=\"{$ntit}\"></th>\n";
echo "<td><a href=\"?in[]=devip&op[]==&st[]={$net}%2F{$nets[$net]}&rep%5B%5D=pop\">{$net}/{$nets[$net]}</a><p>";
echo "<a href=\"Topology-Networks.php?in[]=ifip&op[]==&st[]={$net}%2F{$nets[$net]}\"><img src=\"img/16/glob.png\" title=\"IF IPs\"> " . count(array_keys($dev[$net])) . "</a><p>";
echo "<a href=\"Nodes-List.php?in[]=nodip&op[]==&st[]={$net}%2F{$nets[$net]}\"><img src=\"img/16/nods.png\" title=\"Node IPs\"> " . count(array_keys($nod[$net])) . "</a";
echo "</td>";
echo "<td><table><tr>";
$col = 0;
$dn = ip2long($net);
$max = $dn + pow(2, 32 - $nets[$net]);
for ($a = $dn; $a < $max; $a++) {
if ($col == 64) {
$col = 0;
echo "</tr>\n<tr>";
}
$ip = long2ip($a);
if (array_key_exists($ip, $dev[$net]) and array_key_exists($ip, $nod[$net])) {
echo "<td title=\"{$ip} Dev:" . $dev[$net][$ip] . " Node:" . $nod[$net][$ip] . "\" class=\"warn\"><a href=\"Topology-Networks.php?in[]=ifip&op[]==&st[]={$ip}\"> </a></td>";
//.........這裏部分代碼省略.........
示例9: TopoTable
function TopoTable($reg = "", $cty = "", $bld = "")
{
global $link, $dev, $deval, $dcity, $dbuild, $locsep, $maxcol, $bg1, $bg2, $tabtag;
$query = GenQuery('devices', 's', '*', '', '', array('location'), array('regexp'), array(TopoLoc($reg, $cty, $bld)));
$res = @DbQuery($query, $link);
if ($res) {
while ($d = @DbFetchRow($res)) {
$l = explode($locsep, $d[10]);
if (isset($deval[$d[0]])) {
# Device is monitored if set...
$dcity[$l[0]][$l[1]]['mn']++;
$dcity[$l[0]][$l[1]]['al'] += $deval[$d[0]];
$dbuild[$l[0]][$l[1]][$l[2]]['mn']++;
$dbuild[$l[0]][$l[1]][$l[2]]['al'] += $deval[$d[0]];
$mn = 1;
} else {
$mn = 0;
}
if (!$cty) {
$dcity[$l[0]][$l[1]]['nd']++;
} elseif (!$bld) {
$dbuild[$l[0]][$l[1]][$l[2]]['nd']++;
if ($d[6] > 3) {
$dbuild[$l[0]][$l[1]][$l[2]]['nr']++;
}
} else {
$dev[$l[3]][$l[4]][$d[0]]['rk'] = "{$l['5']} <i>{$l['6']}</i>";
$dev[$l[3]][$l[4]][$d[0]]['ip'] = $d[1];
$dev[$l[3]][$l[4]][$d[0]]['ty'] = $d[3];
$dev[$l[3]][$l[4]][$d[0]]['co'] = $d[11];
$dev[$l[3]][$l[4]][$d[0]]['ic'] = $d[18];
$dev[$l[3]][$l[4]][$d[0]]['mn'] = $mn;
$dev[$l[3]][$l[4]][$d[0]]['al'] = $deval[$d[0]];
}
}
@DbFreeResult($res);
} else {
print @DbError($link);
}
}
示例10: NodPop
function NodPop($in, $op, $st, $co)
{
global $link, $retire;
$query = GenQuery('nodes', 's', 'count(mac)', '', '', $in, $op, $st, $co, 'JOIN devices USING (device)');
$res = DbQuery($query, $link);
$lpop = DbFetchRow($res);
DbFreeResult($res);
return $lpop[0];
}