?>
</td></tr>
<tr><th bgcolor=#<?php 
    echo $bg1;
    ?>
>Interface</th>	<td bgcolor=#<?php 
    echo $bgb;
    ?>
><?php 
    echo $ifimg;
    ?>
 <?php 
    echo $n[7];
    ?>
 (<?php 
    echo ZFix($if[9]);
    ?>
-<?php 
    echo $if[10];
    ?>
) <i><?php 
    echo $if[7];
    ?>
 <?php 
    echo $if[20];
    ?>
</i></td></tr>
<tr><th bgcolor=#<?php 
    echo $bg1;
    ?>
>Vlan</th>		<td bgcolor=#<?php 
    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 
    $query = GenQuery('interfaces', 's', '*', 'ifidx', '', array('device'), array('='), array($shd));
    $res = @DbQuery($query, $link);
    $nif = 0;
    while ($i = @DbFetchRow($res)) {
        $ifn[$i[2]] = $i[1];
        $ift[$i[2]] = $i[4];
        $ifa[$i[2]] = $i[8];
        $ifs[$i[2]] = ZFix($i[9]);
        $ifd[$i[2]] = $i[10];
        $ifi[$i[2]] = "{$i['6']} <i>{$i['7']}</i> <b>{$i['20']}</b>";
        $ifv[$i[2]] = $i[11];
        $ifm[$i[2]] = $i[5];
        $ino[$i[2]] = $i[12];
        $ine[$i[2]] = $i[13];
        $oto[$i[2]] = $i[14];
        $ote[$i[2]] = $i[15];
        $nif++;
    }
    @DbFreeResult($res);
    if (!$nif) {
        echo "</table>\n";
        echo $resmsg;
        echo "<div align=center>{$query}</dev>";
function Drawlink($x1,$y1,$x2,$y2,$prop) {

	$ida = 0;
	$oda = 0;

	$ltxt = "";
	$itxt = "";

	$slabel  = array();
	$elabel = array();
	
        global $fmt,$link,$lev,$lis,$ifi,$ipi,$lwt,$lix,$liy,$net;
	global $trfw,$trfa,$rrdstep,$rrdpath,$rrdcmd;

        if($x1 == $x2){
                $lix[$x1]+= 2;
                $x1 += $lix[$x1];
                $x2 = $x1;
        }
        if($y1 == $y2){
                $liy[$y1]+= 2;
                $y1 += $liy[$y1];
                $y2 = $y1;
        }

	foreach(array_keys($prop['bw']) as $dv){
		foreach(array_keys($prop['bw'][$dv]) as $if){
			if( preg_match("/[tsm]/",$lis) ){
				$rrd = "$rrdpath/" . rawurlencode($dv) . "/" . rawurlencode($if) . ".rrd";
				if (file_exists($rrd)){
					$rrdif["$dv-$if"] = $rrd;
				}else{
					echo "RRD:$rrd not found!\n";
				}
			}elseif($lis == 'r'){
				$iquery	= GenQuery('interfaces','s','dinoct,doutoct','','',array('device','ifname'),array('=','='),array($dv,$if),array('AND') );
				$ires	= @DbQuery($iquery,$link);
				$nres	= @DbNumRows($ires);
				if ($nres == 1) {
					$trf  = @DbFetchRow($ires);
					$ida += $trf[0];
					$oda += $trf[1];
				}
				@DbFreeResult($ires);
			}
			foreach(array_keys($prop['bw'][$dv][$if]) as $ndv){
				foreach(array_keys($prop['bw'][$dv][$if][$ndv]) as $nif){
					if($lis == 'e'){
						$iquery	= GenQuery('interfaces','s','dinerr,douterr','','',array('device','ifname'),array('=','='),array($dv,$if),array('AND') );
						$ires	= @DbQuery($iquery,$link);
						$nres	= @DbNumRows($ires);
						if ($nres == 1) {
							$err  = @DbFetchRow($ires);
							$ida += $err[0];
							$oda += $err[1];
						}
						$iquery	= GenQuery('interfaces','s','dinerr,douterr','','',array('device','ifname'),array('=','='),array($ndv,$nif),array('AND') );
						$ires	= @DbQuery($iquery,$link);
						$nres	= @DbNumRows($ires);
						if ($nres == 1) {
							$err  = @DbFetchRow($ires);
							$oda += $err[0];
							$ida += $err[1];
						}
						@DbFreeResult($ires);
					}
					if($ipi){
						if($net[$dv][$if])  {$ia = $net[$dv][$if];}
						if($net[$ndv][$nif]){$nia= $net[$ndv][$nif];}
					}
					if($ifi){
						if($lev == "f"){
							$in = $if;
							$nin= $nif;
						}else{
							$in = "$dv $if";
							$nin= "$ndv $nif";
						}
					}
					if ($ifi or $ipi){
						array_push($slabel,"$in $ia");
						array_push($elabel,"$nin $nia");
					}
					$bw  += $prop['bw'][$dv][$if][$ndv][$nif];
					$nbw += $prop['nbw'][$dv][$if][$ndv][$nif];
				}
			}
		}
	}
	$xl   = intval($x1  + $x2) / 2;
	$yl   = intval($y1  + $y2) / 2;
	$xi1  = intval($x1+($x2-$x1)/(1 + $lwt/10));
	$xi2  = intval($x2+($x1-$x2)/(1 + $lwt/10));
	$yi1  = intval($y1+($y2-$y1)/(1 + $lwt/10));
	$yi2  = intval($y2+($y1-$y2)/(1 + $lwt/10));
	$bwtxt= ZFix($bw) . "/" . ZFix($nbw);

	if($lis == 'r'){
		if($bw and $nbw){
			$ri = round($ida*800/$bw/$rrdstep);
			$ro = round($oda*800/$nbw/$rrdstep);
			if ($ri > intval($trfa + (100 - $trfa)/2) ){
				$lico = "red";
			}elseif ($ri > $trfa){
				$lico = "orange";
			}elseif ($ri > intval($trfw + $trfw/2) ){
				$lico = "purple";
			}elseif ($ri > $trfw){
				$lico = "blue";
			}else{
				$lico = "limegreen";
			}
			if ($ro > intval($trfa + (100 - $trfa)/2) ){
				$loco = "red";
			}elseif ($ro > $trfa){
				$loco = "orange";
			}elseif ($ro > intval($trfw + $trfw/2) ){
				$loco = "purple";
			}elseif ($ro > $trfw){
				$loco = "blue";
			}else{
				$loco = "limegreen";
			}
		}else{
			$lico = "gray";
			$loco = "gray";
			$ri   = "-";
			$ro   = "-";
		}
		if($fmt == "svg"){
			$ltxt .= "	<line x1=\"$x1\" y1=\"$y1\" x2=\"$xl\" y2=\"$yl\" stroke=\"$lico\" stroke-width=\"4\"/>\n";
			$ltxt .= "	<line x1=\"$xl\" y1=\"$yl\" x2=\"$x2\" y2=\"$y2\" stroke=\"$loco\" stroke-width=\"4\"/>\n";
			$ltxt .= "	<text x=\"$xi2\" y=\"".($yi2-8)."\">${ri}%</text>\n";
			$ltxt .= "	<text x=\"$xi2\" y=\"".($yi1-8)."\">${ro}%</text>\n";
		}else{
			$ltxt .= "Imagesetthickness(\$image,4);\n";
			$ltxt .= "Imageline(\$image,$x1,$y1,$xl,$yl,\$$lico);\n";
			$ltxt .= "Imageline(\$image,$xl,$yl,$x2,$y2,\$$loco);\n";
			$ltxt .= "Imagesetthickness(\$image, 1);\n";
			$itxt .= "ImageString(\$image, 1,$xi2,".($yi2-8).",\"${ri}%\", \$black);\n";
			$itxt .= "ImageString(\$image, 1,$xi1,".($yi1-8).",\"${ro}%\", \$black);\n";
		}
	}elseif($lis == 'e'){
		if ($ida > $rrdstep ){
			$lico = "red";
		}elseif ($ida > intval($rrdstep/60) ){
			$lico = "orange";
		}elseif ($ida > 1){
			$lico = "blue";
		}else{
			$lico = "limegreen";
		}
		if ($oda > $rrdstep ){
			$loco = "red";
		}elseif ($oda > intval($rrdstep/60) ){
			$loco = "orange";
		}elseif ($oda > 1){
			$loco = "blue";
		}else{
			$loco = "limegreen";
		}
		if($fmt == "svg"){
			$ltxt .= "	<line x1=\"$x1\" y1=\"$y1\" x2=\"$xl\" y2=\"$yl\" stroke=\"$lico\" stroke-width=\"4\"/>\n";
			$ltxt .= "	<line x1=\"$xl\" y1=\"$yl\" x2=\"$x2\" y2=\"$y2\" stroke=\"$loco\" stroke-width=\"4\"/>\n";
			$ltxt .= "	<text x=\"$xi2\" y=\"".($yi2-8)."\">$ida</text>\n";
			$ltxt .= "	<text x=\"$xi2\" y=\"".($yi1-8)."\">$oda</text>\n";
		}else{
			$ltxt .= "Imagesetthickness(\$image,4);\n";
			$ltxt .= "Imageline(\$image,$x1,$y1,$xl,$yl,\$$lico);\n";
			$ltxt .= "Imageline(\$image,$xl,$yl,$x2,$y2,\$$loco);\n";
			$ltxt .= "Imagesetthickness(\$image, 1);\n";
			$itxt .= "ImageString(\$image, 1,$xi2,".($yi2-8).",\"$ida\", \$black);\n";
			$itxt .= "ImageString(\$image, 1,$xi1,".($yi1-8).",\"$oda\", \$black);\n";
		}
	}elseif($bw == 11000000 or $bw == 54000000){
		if($fmt == "svg"){
			$ltxt .= "	<line x1=\"$x1\" y1=\"$y1\" x2=\"$x2\" y2=\"$y2\" stroke=\"cornflowerblue\" stroke-dasharray=\"3,3\"/>\n";
		}else{
			$ltxt .= "imagesetstyle(\$image,array(\$navy,\$blue,\$cornflowerblue,\$wte,\$wte) );\n";
			$ltxt .= "Imageline(\$image,$x1,$y1,$x2,$y2,IMG_COLOR_STYLED);\n";
		}
	}elseif($bw < 10000000){
		if($fmt == "svg"){
			$ltxt .= "	<line x1=\"$x1\" y1=\"$y1\" x2=\"$x2\" y2=\"$y2\" stroke=\"limegreen\" />\n";
		}else{
			$ltxt .= "Imageline(\$image,$x1,$y1,$x2,$y2,\$limegreen);\n";
		}
	}elseif($bw < 100000000){
		if($fmt == "svg"){
			$ltxt .= "	<line x1=\"$x1\" y1=\"$y1\" x2=\"$x2\" y2=\"$y2\" stroke=\"blue\" />\n";
		}else{
			$ltxt .= "Imageline(\$image,$x1,$y1,$x2,$y2,\$blue);\n";
		}
	}elseif($bw < 1000000000){
		if($fmt == "svg"){
			$ltxt .= "	<line x1=\"$x1\" y1=\"$y1\" x2=\"$x2\" y2=\"$y2\" stroke=\"purple\" />\n";
		}else{
			$ltxt .= "Imageline(\$image,$x1,$y1,$x2,$y2,\$purple);\n";
		}
	}elseif($bw == 1000000000){
		if($fmt == "svg"){
			$ltxt .= "	<line x1=\"$x1\" y1=\"$y1\" x2=\"$x2\" y2=\"$y2\" stroke=\"orange\" />\n";
		}else{
			$ltxt .= "Imageline(\$image,$x1,$y1,$x2,$y2,\$orange);\n";
		}
	}else{
		$lt = ($bw/1000000000 < 10)?($bw/1000000000):10;
		if($fmt == "svg"){
			$ltxt .= "	<line x1=\"$x1\" y1=\"$y1\" x2=\"$x2\" y2=\"$y2\" stroke=\"red\" stroke-width=\"$lt\"/>\n";
		}else{
			$ltxt .= "imagesetthickness(\$image,$lt);\n";
			$ltxt .= "Imageline(\$image,$x1,$y1,$x2,$y2,\$red);\n";
			$ltxt .= "Imagesetthickness(\$image, 1);\n";
		}
	}

	if($lis	and is_array($rrdif) ){
		$opts = GraphOpts($lis,0,'Link Traffic',$bw);
		list($drawin,$drawout,$tit) = GraphTraffic($rrdif,'trf');
		exec("$rrdcmd graph log/$xl$yl.png -a PNG $opts $drawin $drawout");
		if($lis == "t"){
			if($fmt == "svg"){
				$itxt .= "	<text x=\"".($xl-16)."\" y=\"".($yl-18)."\" fill=\"green\">$bwtxt</text>\n";
			}else{
				$itxt .= "ImageString(\$image, 1,".($xl-16).", ".($yl-18).", \"$bwtxt\", \$green);\n";
			}
		}
		if($fmt == "svg"){
				$itxt .= "	<text x=\"".($xl-16)."\" y=\"".($yl-18)."\" fill=\"green\">no RRDs in SVG!</text>\n";
		}else{
			$ltxt .= "\$icon = Imagecreatefrompng(\"$xl$yl.png\");\n";
			$ltxt .= "\$w = Imagesx(\$icon);\n";
			$ltxt .= "\$h = Imagesy(\$icon);\n";
			$ltxt .= "Imagecopy(\$image, \$icon,$xl-\$w/2,$yl-\$h/2,0,0,\$w,\$h);\n";
			$ltxt .= "Imagedestroy(\$icon);\n";
			$ltxt .= "unlink(\"$xl$yl.png\");\n";
		}
	}elseif( preg_match("/[rw]/",$lis) ){
		if($fmt == "svg"){
			$itxt .= "	<text x=\"".($xl-16)."\" y=\"$yl\" fill=\"green\">$bwtxt</text>\n";
		}else{
			$itxt .= "ImageString(\$image, 1, ".($xl-16).",$yl, \"$bwtxt\", \$green);\n";
		}
	}
	$yof = 0;
	foreach ($slabel as $i){
		$i = preg_replace('/[$&]/','.', $i);
		if($fmt == "svg"){
			$itxt .= "	<text x=\"$xi2\" y=\"".($yi2+$yof)."\" fill=\"green\">$i</text>\n";
		}else{
			$itxt .= "ImageString(\$image, 1, $xi2, ".($yi2+$yof).", \"$i\", \$green);\n";
		}
		$yof += 8;
	}
	$yof = 0;
	foreach ($elabel as $i){
		if($fmt == "svg"){
			$itxt .= "	<text x=\"$xi1\" y=\"".($yi1+$yof)."\" fill=\"green\">".Safelabel($i)."</text>\n";
		}else{
			$itxt .= "ImageString(\$image, 1, $xi1, ".($yi1+$yof).", \"".Safelabel($i)."\", \$green);\n";
		}
		$yof += 8;
	}
	return array($ltxt,$itxt);
}
     $isp[$i[2]] = $i[9];
 }
 @DbFreeResult($res);
 $r = DevRoutes($devip[$rtr], $devcom[$rtr]);
 $row = 0;
 foreach (array_keys($r) as $rd) {
     if ($row % 2) {
         $bg = $bga;
         $bi = $bia;
     } else {
         $bg = $bgb;
         $bi = $bib;
     }
     $row++;
     $if = $ina[$r[$rd]['ifx']] . " " . $ial[$r[$rd]['ifx']] . " " . $icm[$r[$rd]['ifx']];
     $spd = ZFix($isp[$r[$rd]['ifx']]);
     $rpimg = RteProto($r[$rd]['pro']);
     $unh = rawurlencode($netif[$r[$rd]['nho']]);
     list($pfix, $msk, $bmsk) = Masker($r[$rd]['msk']);
     list($ifimg, $iftit) = Iftype($ity[$r[$rd]['ifx']]);
     list($ntimg, $ntit) = Nettype($rd);
     echo "<tr bgcolor=#{$bg}>";
     echo "<td bgcolor={$bi} width=20 align=center><img src=img/16/{$ntimg} title={$ntit}></td>\n";
     echo "<td><a href=Topology-Map.php?ina=network&flt={$rd}%2F{$pfix}&draw=1>{$rd}/{$pfix}</a></td>\n";
     echo "<td>" . $r[$rd]['nho'] . " <a href=?rtr={$unh}>" . $netif[$r[$rd]['nho']] . "</a></td><td><img src=img/{$ifimg} title={$iftit} hspace=4> {$if}</td>\n";
     echo "<td align=right>{$spd}</td><td align=center>" . $r[$rd]['me1'] . "</td>\n";
     echo "<td><img src=img/16/{$rpimg}.png> " . $r[$rd]['pro'] . "</td><td align=right>" . $r[$rd]['age'] . "</td>\n";
     echo "</tr>\n";
 }
 echo "</table><table bgcolor=#666666 {$tabtag} >\n";
 echo "<tr bgcolor=#{$bg2}><td>{$row} entries in route table</td></tr></table>\n";
function Drawlink($x1, $y1, $x2, $y2, $prop)
{
    $slab = array();
    $elab = array();
    global $maplinks, $lev, $gra, $ifi, $ipi, $lwt, $lix, $liy, $net, $rrdstep, $rrdpath, $rrdcmd;
    if ($x1 == $x2) {
        $lix[$x1] += 2;
        $x1 += $lix[$x1];
        $x2 = $x1;
    }
    if ($y1 == $y2) {
        $liy[$y1] += 2;
        $y1 += $liy[$y1];
        $y2 = $y1;
    }
    foreach (array_keys($prop['bw']) as $dv) {
        foreach (array_keys($prop['bw'][$dv]) as $if) {
            if ($gra) {
                $rrd = "{$rrdpath}/" . rawurlencode($dv) . "/" . rawurlencode($if) . ".rrd";
                if (file_exists($rrd)) {
                    $rrdif["{$dv}-{$if}"] = $rrd;
                } else {
                    echo "RRD:{$rrd} not found!\n";
                }
            }
            foreach (array_keys($prop['bw'][$dv][$if]) as $ndv) {
                foreach (array_keys($prop['bw'][$dv][$if][$ndv]) as $nif) {
                    if ($ipi) {
                        if ($net[$dv][$if]) {
                            $ia = $net[$dv][$if];
                        }
                        if ($net[$ndv][$nif]) {
                            $nia = $net[$ndv][$nif];
                        }
                    }
                    if ($ifi) {
                        if ($lev == "f") {
                            $in = $if;
                            $nin = $nif;
                        } else {
                            $in = "{$dv} {$if}";
                            $nin = "{$ndv} {$nif}";
                        }
                    }
                    if ($ifi or $ipi) {
                        array_push($slab, "{$in} {$ia}");
                        array_push($elab, "{$nin} {$nia}");
                    }
                    $bw += $prop['bw'][$dv][$if][$ndv][$nif];
                    $nbw += $prop['nbw'][$dv][$if][$ndv][$nif];
                }
            }
        }
    }
    if ($bw == 11000000 or $bw == 54000000) {
        #$maplinks[] = "Imageline(\$image,$x1,$y1,$x2,$y2,\$org);";
        $maplinks[] = "imagesetstyle(\$image,array(\$bl2,\$bl2,\$wte,\$wte) );";
        $maplinks[] = "Imageline(\$image,{$x1},{$y1},{$x2},{$y2},IMG_COLOR_STYLED);";
    } elseif ($bw < 10000000) {
        $maplinks[] = "Imageline(\$image,{$x1},{$y1},{$x2},{$y2},\$grn);";
    } elseif ($bw < 100000000) {
        $maplinks[] = "Imageline(\$image,{$x1},{$y1},{$x2},{$y2},\$bl2);";
    } elseif ($bw < 1000000000) {
        $maplinks[] = "Imageline(\$image,{$x1},{$y1},{$x2},{$y2},\$bl3);";
    } elseif ($bw == 1000000000) {
        $maplinks[] = "Imageline(\$image,{$x1},{$y1},{$x2},{$y2},\$red);";
    } else {
        $maplinks[] = "imagesetthickness(\$image," . $bw / 1000000000 . ");";
        $maplinks[] = "Imageline(\$image,{$x1},{$y1},{$x2},{$y2},\$re2);";
        $maplinks[] = "Imagesetthickness(\$image, 1);";
    }
    $xl = intval($x1 + $x2) / 2;
    $yl = intval($y1 + $y2) / 2;
    $clab = ZFix($bw) . "/" . ZFix($nbw);
    if ($gra and is_array($rrdif)) {
        $opts = GraphOpts($gra, 0, 'Link Traffic');
        list($drawin, $drawout, $tit) = GraphTraffic($rrdif, 'trf');
        exec("{$rrdcmd} graph log/{$xl}{$yl}.png -a PNG {$opts} {$drawin} {$drawout}");
        if ($gra == "t") {
            $maplinks[] = "ImageString(\$image, 1,{$xl}-16,{$yl}-18,\"{$clab}\", \$grn);";
        }
        $maplinks[] = "\$icon = Imagecreatefrompng(\"{$xl}{$yl}.png\");";
        $maplinks[] = "\$w = Imagesx(\$icon);";
        $maplinks[] = "\$h = Imagesy(\$icon);";
        $maplinks[] = "Imagecopy(\$image, \$icon,{$xl}-\$w/2,{$yl}-\$h/2,0,0,\$w,\$h);";
        $maplinks[] = "Imagedestroy(\$icon);";
        $maplinks[] = "unlink(\"{$xl}{$yl}.png\");";
    } else {
        $maplinks[] = "ImageString(\$image, 1,{$xl}-16,{$yl},\"{$clab}\", \$grn);";
    }
    $xi1 = intval($x1 + ($x2 - $x1) / (1 + $lwt / 10));
    $xi2 = intval($x2 + ($x1 - $x2) / (1 + $lwt / 10));
    $yi1 = intval($y1 + ($y2 - $y1) / (1 + $lwt / 10));
    $yi2 = intval($y2 + ($y1 - $y2) / (1 + $lwt / 10));
    $yof = 0;
    foreach ($slab as $i) {
        $maplinks[] = "ImageString(\$image, 1,{$xi2},{$yi2}+{$yof},\"{$i}\", \$gr2);";
        $yof += 8;
    }
    $yof = 0;
    foreach ($elab as $i) {
        $maplinks[] = "ImageString(\$image, 1,{$xi1},{$yi1}+{$yof},\"{$i}\", \$gr2);";
        $yof += 8;
    }
}
			echo "<tr class=\"$bg\">";
			if(in_array("ifname",$col)){
				list($ifimg,$iftit)	= Iftype($if[4]);
				echo "<th class=\"$bi\"><img src=\"img/$ifimg\" title=\"$iftit\"></th>";
			}
			echo "<td><a href=Nodes-List.php?ina=device&opa==&sta=$ud&cop=AND&inb=ifname&opb==&stb=$ui>$if[1]</a></td>\n";
			if(in_array("device",$col)){
				echo "<td><a href=Devices-Status.php?dev=$ud>$if[0]</a></td>\n";
			}
			if(in_array("ifidx",$col)){echo "<td align=right>$if[2]</td>";}
			if(in_array("type",$col)){echo "<td align=right>$if[4]</td>";}
			if(in_array("mac",$col)){echo "<td>$if[5]</td>";}
			if(in_array("description",$col)){echo "<td>$if[6]</td>";}
			if(in_array("alias",$col)){echo "<td>$if[7]</td>";}
			if(in_array("status",$col)){echo "<td align=right>$if[8]</td>";}
			if(in_array("speed",$col)){echo "<td align=right>".ZFix($if[9])."</td>";}
			if(in_array("duplex",$col)){echo "<td>$if[10]</td>";}
			if(in_array("vlid",$col)){echo "<td align=right>$if[11]</td>";}

			if(in_array("inoct",$col)){echo "<td align=right>$if[12]</td>";}
			if(in_array("inerr",$col)){echo "<td align=right>$if[13]</td>";}
			if(in_array("outoct",$col)){echo "<td align=right>$if[14]</td>";}
			if(in_array("outerr",$col)){echo "<td align=right>$if[15]</td>";}
			if(in_array("dinoct",$col)){echo "<td align=right>$if[16]</td>";}
			if(in_array("dinerr",$col)){echo "<td align=right>$if[17]</td>";}
			if(in_array("doutoct",$col)){echo "<td align=right>$if[18]</td>";}
			if(in_array("douterr",$col)){echo "<td align=right>$if[19]</td>";}

			if(in_array("comment",$col)){echo "<td>$if[20]</td>";}
			if(in_array("graphs",$col)){
				echo "<td nowrap align=\"center\">\n";
     echo "<td align=right>{$if['4']}</td>";
 }
 if (in_array("mac", $col)) {
     echo "<td>{$if['5']}</td>";
 }
 if (in_array("description", $col)) {
     echo "<td>{$if['6']}</td>";
 }
 if (in_array("alias", $col)) {
     echo "<td>{$if['7']}</td>";
 }
 if (in_array("status", $col)) {
     echo "<td align=right>{$if['8']}</td>";
 }
 if (in_array("speed", $col)) {
     echo "<td align=right>" . ZFix($if[9]) . "</td>";
 }
 if (in_array("duplex", $col)) {
     echo "<td>{$if['10']}</td>";
 }
 if (in_array("vlid", $col)) {
     echo "<td align=right>{$if['11']}</td>";
 }
 if (in_array("inoct", $col)) {
     echo "<td align=right>{$if['12']}</td>";
 }
 if (in_array("inerr", $col)) {
     echo "<td align=right>{$if['13']}</td>";
 }
 if (in_array("outoct", $col)) {
     echo "<td align=right>{$if['14']}</td>";
        $isp[$i[2]] = $i[9];
    }
    @DbFreeResult($res);
    $r = DevRoutes($devip[$rtr], $devcom[$rtr]);
    $row = 0;
    foreach (array_keys($r) as $dst) {
        if ($row % 2) {
            $bg = $bga;
            $bi = $bia;
        } else {
            $bg = $bgb;
            $bi = $bib;
        }
        $row++;
        $if = $ina[$r[$dst]['ifx']] . " (" . $ial[$r[$dst]['ifx']] . " " . $icm[$r[$dst]['ifx']] . ")";
        $spd = ZFix($isp[$r[$dst]['ifx']]);
        $rpimg = RteProto($r[$dst]['pro']);
        list($pfix, $msk, $bmsk) = Masker($r[$dst]['msk']);
        list($ifimg, $iftit) = Iftype($ity[$r[$dst]['ifx']]);
        list($ntimg, $ntit) = Nettype($dst);
        echo "<tr bgcolor=#{$bg}>";
        echo "<td bgcolor={$bi} width=20 align=center><img src=img/16/{$ntimg} title={$ntit}></td>\n";
        echo "<td>{$dst}/{$pfix}</td><td>" . $r[$dst]['nho'] . "</td><td><img src=img/{$ifimg} title={$iftit} hspace=4> {$if}</td>\n";
        echo "<td align=right>{$spd}</td><td align=center>" . $r[$dst]['me1'] . "</td>\n";
        echo "<td><img src=img/16/{$rpimg}.png>" . $r[$dst]['pro'] . "</td><td align=right>" . $r[$dst]['age'] . "</td>\n";
        echo "</tr>\n";
    }
    echo "</table><table bgcolor=#666666 {$tabtag} >\n";
    echo "<tr bgcolor=#{$bg2}><td>{$row} results using {$query}</td></tr></table>\n";
}
include_once "inc/footer.php";