Location: PHPKode > projects > Network Asset Management Archive > nama/liaso/totaliava.php
<html>
<head>
<title>Iava Totals</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<?php
$labname = $_GET['LABNAME'];
$lab = $_GET['lab'];
$vnum = $_GET['vnum'];
$now = date("m/j/y h:i:s",time());
include "../connect.php";
$tablerow = "style='border-color:#DBB748; border-width:1px; border-right: 2px s
olid #DBB748; border-collapse: collapse; border-style:solid;'";
$now = date("j/m/y h:i:s",time());
echo '<body bgcolor="#F9F3E0">';

//$vnum = 'A2003-0028.1';
//$lab = 1;
//$labname = 'ITL';

$tablerow = "style='border-color:#DBB748; border-width:1px; border-right: 2px solid #DBB748; border-collapse: collapse; border-style:solid;'";
$tablerow3 = "style='background-color: #FFCCCC; border-color:#DBB748; border-width:1px; border-right: 2px solid #DBB748; border-collapse: collapse; border-style:solid;'";
$stmt = "select * from vulnerability where num = '$vnum';";
$sth = ibase_query($dbh, $stmt);
$row = ibase_fetch_object($sth);

Print '<b>IAVA:</b> ' . $vnum . '	<b>Description:</b><a href=' . substr($row->LINK,1) . ' TARGET=_blank>' . $row->DESCRIPT . '</a>'; 

?>
<table style='border-color:#DBB748; border-width:3px; border-right: 3px solid #DBB748; border-collapse: collapse; border-style:solid;' width="700" border="2">
<?
$i=0;
$firsttime=1;
$reportheader = '<th ' . $tablerow . '>Lab</th>';
$stmt3 = "select * from lab;";
$sth3 = ibase_query($dbh, $stmt3);
while ($row3 = ibase_fetch_object($sth3)) {
$reportthis = '<td ' . $tablerow  . '><a href="/liaso/reportiava.php?lab=' . $row3->SERIAL . '&vnum=' . $vnum . '&LABNAME=' . $row3->LAB . '" target=_blank>' . $row3->LAB  . '</a></td>';
$stmt2 = "select OS_SERIAL, v.serial as vserial, o.serial as oserial from os_application o, vulnerability v where (o.vulnerability_serial = v.serial) and (v.num = '$vnum');";
$sth2 = ibase_query($dbh, $stmt2);
$i=0;
while ($row2 = ibase_fetch_object($sth2)) {
$stmt5 = "select * from iavacompliance where (lab = $row3->SERIAL) and (vulnerability = '$row2->VSERIAL');";
$sth5 = ibase_query($dbh, $stmt5);
if ($row5 = ibase_fetch_object($sth5)) {
$tablerow2 = "style='background-color: #CCFF99;border-color:#DBB748; border-width:1px; border-right: 2px solid #DBB748; border-collapse: collapse; border-style:solid;'";
} else {
$tablerow2 = "style='border-color:#DBB748; border-width:1px; border-right: 2px solid #DBB748; border-collapse: collapse; border-style:solid;'";
//$tablerow2 = "style='background-color: #FFCCCC; border-color:#DBB748; border-width:1px; border-right: 2px solid #DBB748; border-collapse: collapse; border-style:solid;'";
}
$stmt4 = "select * from iavacompliance where (lab = $row3->SERIAL) and (vulnerability = '$row2->VSERIAL') and (os_application = '$row2->OSERIAL');";
$sth4 = ibase_query($dbh, $stmt4);
$row4 = ibase_fetch_object($sth4);
$stmt6 = "select count(*) as total from arp_table a, subnets b, lab c where (a.subnet = b.subnet) and (b.lab = c.serial) and (b.LAB = '$row3->SERIAL')  and (OS CONTAINING '$row2->OS_SERIAL') and (a.ip_address<>'0.0.0.0');";
$sth6 = ibase_query($dbh, $stmt6);
$row6 = ibase_fetch_object($sth6);

if ($row4->A == '') {$A = '0';} else {$A=$row4->A; $tota[$i] += $row4->A;}
if ($row4->B == '') {$B = '0';} else {$B=$row4->B; $totb[$i] += $row4->B;}
if ($row4->C == '') {$C = '0';} else {$C=$row4->C; $totc[$i] += $row4->C;}
if ($row4->D == '') {$D = '0';} else {$D=$row4->D; $totd[$i] += $row4->D;}
if ($row4->E == '') {$E = '0';} else {$E=$row4->E; $tote[$i] += $row4->E;}
$reportheader .= '<th colspan="5" ' . $tablerow . '>' . $row2->OS_SERIAL . '</th>';
if ($row6->TOTAL != $row4->A) {
   $reportthis = $reportthis . '<td ' . $tablerow3 . '>' . $A . '</td><td ' . $tablerow3 . '>' . $B . '</td><td ' . $tablerow3 . '>' . $C . '</td><td ' . $tablerow3 . '>' . $D .'</td><td ' . $tablerow3 . '>' . $E . '</td>';
} else {
   $reportthis = $reportthis . '<td ' . $tablerow2 . '>' . $A . '</td><td ' . $tablerow2 . '>' . $B . '</td><td ' . $tablerow2 . '>' . $C . '</td><td ' . $tablerow2 . '>' . $D .'</td><td ' . $tablerow2 . '>' . $E . '</td>';
}
$i +=1;
}
if ($firsttime==1) {
    print $reportheader;
    $firsttime = 0;
}
 print '<tr>' .  $reportthis . '</tr>';
} 
$stmt2 = "select OS_SERIAL, v.serial as vserial, o.serial as oserial from os_application o, vulnerability v where (o.vulnerability_serial = v.serial) and (v.num = '$vnum');";
$sth2 = ibase_query($dbh, $stmt2);
$i=0;
$reportthese = '';
$reportthis = '<tr><td><b>Total</b></td>';
while ($row2 = ibase_fetch_object($sth2)) {
   if ($tota[$i]=='') {$tota[$i] = 0;}
   if ($totb[$i]=='') {$totb[$i] = 0;}
   if ($totc[$i]=='') {$totc[$i] = 0;}
   if ($totd[$i]=='') {$totd[$i] = 0;}
   if ($tote[$i]=='') {$tote[$i] = 0;}
   $reportthis .=  '<td ' . $tablerow . '>' . $tota[$i] . '</td><td ' . $tablerow . '>' . $totb[$i] . '</td><td ' . $tablerow . '>' . $totc[$i] . '</td><td ' . $tablerow . '>' . $totd[$i] .'</td><td ' . $tablerow . '>' . $tote[$i] . '</td>';
if (($tota[$i] != 0) || ($totb[$i] != 0) || ($totc[$i] != 0) || ($totd[$i] != 0) || ($tote[$i] != 0)) {
$reportthese .= $row2->OS_SERIAL . ' (' . $tota[$i] . '/' . $totb[$i] . '/' . $totc[$i] . '/' . $totd[$i] .'/' . $tote[$i] . ') ';
}
$i += 1;
}
print $reportthis . '</tr>';

print '</table>';

print $reportthese;
$A = 0; $B = 0; $C = 0; $D = 0; $E = 0;
for ($i=0; $i<count($tota); $i++) {
$A += $tota[$i];
$B += $totb[$i];
$C += $totc[$i];
$D += $tote[$i];
$E += $tote[$i];
}
print '<BR><BR><BR><B>TOTALS:</b> (' . $A . '/' . $B . '/' . $C . '/' . $D .'/' . $E . ') '
?>
</body>
</html>

Return current item: Network Asset Management Archive