<?php


include ('header.php');

echo "<h2><i><font face=\"Verdana\" color=\"#6797BF\">Top 10 Vulnerabilities - all time</font></i></h2>By Nessus Risk";

$query = "select distinct risk from nessus_results where scriptid <> '' and username='$username' and falsepositive<>'Y' and msg<>'' and scriptid <>10180 order by risk";
$result=$dbconn->execute($query);

while(!$result->EOF) {
	list ($riskval)= $result->fields;

//	echo $riskval."<br>";



$query1="select count(t1.scriptid) as vcount, t1.scriptid, t2.name  from nessus_results as t1, plugins as t2 where t1.scriptid <> '' and t1.risk = $riskval and t1.scriptid=t2.id and t1.username='$username' and t1.falsepositive<>'Y' and t1.scriptid <>10180  group by t1.scriptid order by vcount desc limit 0,10";
$result1=$dbconn->execute($query1);

	echo "<br><b><u>".getrisk($riskval)."</u></b><br>";

 echo "<table summary=\"".getrisk($riskval)."\"border=\"1\"><tr><td>ID</td><td>Name</td><td>Count</td></tr>";
while(!$result1->EOF) {
	list ($vcount, $vscriptid, $vname)=$result1->fields;

		echo "<tr><td><a href=\"lookup.php?id=$vscriptid\">$vscriptid</a></td><td><a href=\"lookup.php?id=$vscriptid\">$vname</a></td><td>$vcount</td></tr>";

	$result1->MoveNext();
}
	echo "</table>";

	$result->MoveNext();
} //Endo fo While



include('footer.php');

function getrisk($risk) {

switch ($risk) {
    case 1:
        $risk="Serious";
        break;
    case 2:
        $risk="High";
        break;
    case 3:
        $risk="Medium";
        break;
    case 4:
        $risk="Medium/Low";
        break;
    case 5:
        $risk="Low/Medium";
        break;
    case 6:
        $risk="Low";
        break;
    case 7:
        $risk="Info";
        break;
}

return $risk;
}



?>
