$res = @DbQuery($query, $link); if ($res) { $nli = 0; $row = 0; while ($l = @DbFetchRow($res)) { $ud = urlencode($l[1]); $un = urlencode($l[3]); if ($row % 2) { $bg = $bga; $bi = $bia; } else { $bg = $bgb; $bi = $bib; } $row++; echo "<tr bgcolor=#{$bg}><td><a href=Devices-Status.php?dev={$ud}>{$l['1']}</a></td><td>{$l['2']}</td>\n"; echo "<th>{$l['6']}</th>\n"; echo "<td align=right>" . Zfix($l[5]) . "</td>\n"; echo "<td align=right>{$l['7']}</td>"; echo "<td><a href=Devices-Status.php?dev={$un}>{$l['3']}</a></td><td>{$l['4']} (Vlan{$l['9']} {$l['8']})</td>\n"; echo "<th><a href=?dli={$l['0']}&dv={$l['1']}><img src=img/16/bcnl.png border=0 hspace=8 onclick=\"return confirm('Delete link?');\" title=\"Delete link\"></a></th></tr>\n"; $nli++; } @DbFreeResult($res); } else { print @DbError($link); } echo "</table><table bgcolor=#666666 {$tabtag} >\n"; echo "<tr bgcolor=#{$bg2}><td>{$nli} links with {$query}</td></tr></table>\n"; } include_once "inc/footer.php";
if (in_array("ifchanges", $col)) { echo "<td align=right>{$n['11']}</td>"; } if (in_array("ifdet", $col)) { $link = @DbConnect($dbhost, $dbuser, $dbpass, $dbname); $iquery = GenQuery('interfaces', 's', '*', '', '', array('device', 'ifname'), array('=', '='), array($n[6], $n[7]), array('AND')); $ires = @DbQuery($iquery, $link); $nif = @DbNumRows($ires); if ($nif == 1) { $if = @DbFetchRow($ires); if ($if[8] == "2") { $ifimg = "<img src=img/bulbr.png title=\"Disabled!\">"; } else { $ifimg = "<img src=img/bulbg.png title=\"Enabled\">"; } echo "<td> {$ifimg} " . Zfix($if[9]) . "-{$if['10']} <i>{$if['7']} {$if['20']}</i></td>"; } else { echo "<td>-</td>"; } @DbFreeResult($ires); } if (in_array("graph", $col)) { echo "<td nowrap align=center>\n"; echo "<a href=Devices-Graph.php?dv={$ud}&if%5B%5D={$ui}><img src=inc/drawrrd.php?dv={$ud}&if%5B%5D={$ui}&s=s&t=trf border=0>\n"; echo "<img src=inc/drawrrd.php?dv={$ud}&if%5B%5D={$ui}&s=s&t=err border=0></a>\n"; } if (in_array("firstseen", $col)) { $fs = date("j.M G:i:s", $n[4]); echo "<td bgcolor=#{$fc}>{$fs}</td>"; } if (in_array("lastseen", $col)) {
# China in your hand ;-) if (@DbNumRows($res)) { while ($l = @DbFetchRow($res)) { if ($row % 2) { $bg = $bga; $bi = $bia; } else { $bg = $bgb; $bi = $bib; } $row++; $tpow += $l[7]; $ul = rawurlencode($l[3]); echo "<tr bgcolor=#{$bg}>"; echo "<th bgcolor=#{$bi}>{$l['2']}</th><td><a href={$_SERVER['PHP_SELF']}?dev={$ul}>{$l['3']}</a> on {$l['4']} (Vlan{$l['9']} {$l['8']})</td>"; echo "<td align=right>" . Zfix($l[5]) . "</td><td align=right>{$l['7']}</td>"; echo "<td align=center>{$l['6']}</td></tr>\n"; } @DbFreeResult($res); } else { echo "<tr bgcolor=#{$bga}><th colspan=5>{$resmsg}</th></tr>\n"; } echo "</table><table bgcolor=#666666 {$tabtag} >\n"; echo "<tr bgcolor=#{$bg2}><td>{$row} Links sucking " . $tpow / 1000 . " W total</td></tr></table>\n"; flush(); ?> </td></tr> </table> <h2>Interfaces</h2><p> <?php
echo "<td bgcolor=#$i1c>$iu</td>"; } if(in_array("ifchanges",$col)) {echo "<td align=right>$n[11]</td>";} if(in_array("ifdet",$col)){ $link = @DbConnect($dbhost,$dbuser,$dbpass,$dbname); $iquery = GenQuery('interfaces','s','*','','',array('device','ifname'),array('=','='),array($n[6],$n[7]),array('AND') ); $ires = @DbQuery($iquery,$link); $nif = @DbNumRows($ires); if ($nif == 1) { $if = @DbFetchRow($ires); if ($if[8] == "2"){ $ifimg = "<img src=\"img/bulbr.png\" title=\"Disabled!\">"; }else{ $ifimg = "<img src=\"img/bulbg.png\" title=\"Enabled\">"; } echo "<td> $ifimg ".Zfix($if[9])."-$if[10] <i>$if[7] $if[20]</i></td>"; }else{ echo "<td>-</td>"; } @DbFreeResult($ires); } if(in_array("graph",$col)){ echo "<td nowrap align=center>\n"; echo "<a href=Devices-Graph.php?dv=$ud&if%5B%5D=$ui><img src=\"inc/drawrrd.php?dv=$ud&if%5B%5D=$ui&s=s&t=trf\">\n"; echo "<img src=\"inc/drawrrd.php?dv=$ud&if%5B%5D=$ui&s=s&t=err\"></a>\n"; } if(in_array("firstseen",$col)){ $fs = date("j.M G:i:s",$n[4]); echo "<td bgcolor=#$fc>$fs</td>"; } if(in_array("lastseen",$col)){
function TrafficCharts($traffic,$typ){ global $lim,$ifal,$ifsp; if($typ == "trf"){ $unit = "octets"; }else{ $unit = "errors"; } arsort($traffic); $row = 0; foreach ($traffic as $di => $tr){ if ($row % 2){$bg = "txta"; $bi = "imga";}else{$bg = "txtb"; $bi = "imgb";} $row++; $d = explode(';;', $di); $ud = rawurlencode($d[0]); $ui = rawurlencode($d[1]); echo "<tr class=\"$bg\"><th class=\"$bi\">\n"; echo "$row</th><td><a href=Devices-Status.php?dev=$ud>$d[0]</a></td>\n"; echo "<td><a href=Nodes-List.php?ina=device&opa==&sta=$ud&cop=AND&inb=ifname&opb==&stb=$ui>$d[1]</a> $ifal[$di] <i>"; echo Zfix($ifsp[$di]) ."</i></td>\n"; echo "<td align=center>\n"; echo "<a href=Devices-Graph.php?dv=$ud&if%5B%5D=$ui>"; echo "<img src=inc/drawrrd.php?dv=$ud&if%5B%5D=$ui&s=s&t=$typ title=\"$tr $unit\"></a>\n"; if($row == $lim){break;} } }
function TrafficCharts($traffic, $typ) { global $bga, $bgb, $bia, $bib, $lim, $ifal, $ifsp; if ($typ == "trf") { $unit = "octets"; } else { $unit = "errors"; } arsort($traffic); $row = 0; foreach ($traffic as $di => $tr) { if ($row % 2) { $bg = $bga; $bi = $bia; } else { $bg = $bgb; $bi = $bib; } $row++; $d = explode(';;', $di); $ud = rawurlencode($d[0]); $ui = rawurlencode($d[1]); echo "<tr bgcolor=#{$bg}>\n"; echo "<th bgcolor=#{$bi}>{$row}</th><td><a href=Devices-Status.php?dev={$ud}>{$d['0']}</a></td>\n"; echo "<td><a href=Nodes-List.php?ina=device&opa==&sta={$ud}&cop=AND&inb=ifname&opb==&stb={$ui}>{$d['1']}</a> {$ifal[$di]} <i>"; echo Zfix($ifsp[$di]) . "</i></td>\n"; echo "<td align=center>\n"; echo "<a href=Devices-Graph.php?dv={$ud}&if%5B%5D={$ui}>"; echo "<img src=inc/drawrrd.php?dv={$ud}&if%5B%5D={$ui}&s=s&t={$typ} border=0 title=\"{$tr} {$unit}\"></a>\n"; if ($row == $lim) { break; } } }
if ($libw[$dv][$if][$nb][$ni] != $libw[$nb][$ni][$dv][$if]) { if ($row % 2) { $bg = $bga; $bi = $bia; } else { $bg = $bgb; $bi = $bib; } $row++; echo "<tr bgcolor=#{$bg}>\n"; echo "<th bgcolor={$bi}><img src=img/spd.png title=\"bandwidth\"></th>\n"; echo "<td><a href=Devices-Status.php?dev={$ud}>{$dv}</a></td><td>{$if} (" . Zfix($ifsp["{$dv};;{$if}"]) . ")</td>\n"; echo "<th>" . Zfix($libw[$dv][$if][$nb][$ni]) . "</th>\n"; echo "<th bgcolor={$bi}>" . $lity[$dv][$if][$nb][$ni] . "</th>\n"; echo "<td><a href=Devices-Status.php?dev={$un}>{$nb}</a></td><td>{$ni} (" . Zfix($ifsp["{$nb};;{$ni}"]) . ")</td>\n"; echo "<th>" . Zfix($libw[$nb][$ni][$dv][$if]) . "</th></tr>\n"; } } if ($alt or strlen($lidu[$dv][$if][$nb][$ni]) == 2 and strlen($lidu[$nb][$ni][$dv][$if]) == 2) { if ($lidu[$dv][$if][$nb][$ni] != $lidu[$nb][$ni][$dv][$if]) { if ($row % 2) { $bg = $bga; $bi = $bia; } else { $bg = $bgb; $bi = $bib; } $row++; echo "<tr bgcolor=#{$bg}>\n"; echo "<th bgcolor={$bi}><img src=img/dpx.png title=\"duplex\"></th>\n"; echo "<td><a href=Devices-Status.php?dev={$ud}>{$dv}</a></td><td>{$if} (" . $ifdu["{$dv};;{$if}"] . ")</td>\n";