<?php    


include("header.php");

	echo "<h2>Vulnerabilities Found (By Date):</h2>";
	echo "<img src='graph2.php?days=7&amp;chart_type=1'><br>";
$query="select count(distinct(host)) from nessus_results where TO_DAYS(now()) - TO_DAYS(scantime) <=7 and username='$username' and falsepositive<>'Y' and scriptid <> 10180 and msg<>''";
	$result=$dbconn->execute($query);
	list($syscount)=$result->fields;
	echo "Tested - $syscount systems";
$query="select count(distinct scantime) from nessus_results where TO_DAYS(now()) - TO_DAYS(scantime) <=7 and username='$username' and falsepositive<>'Y' and scriptid <> 10180 and msg<>''";
        $result=$dbconn->execute($query);
        list($syscount)=$result->fields;
	echo ", $syscount times.";
	$query="select count(scantime) from nessus_results where TO_DAYS(now()) - TO_DAYS(scantime) <=7 and username='$username' and falsepositive<>'Y' and scriptid <> 10180 and msg<>''";
        $result=$dbconn->execute($query);
	list($vulncount)=$result->fields;
	echo " Found $vulncount vulnerabilities - averaging ".round($vulncount/$syscount,2)." vulnerabilities per scan.<br><br>";

	echo "<img src='graph2.php?days=30&amp;chart_type=1'><br>";
$query="select count(distinct(host)) from nessus_results where TO_DAYS(now()) - TO_DAYS(scantime) <=30 and username='$username' and falsepositive<>'Y' and scriptid <> 10180 and msg<>''";
        $result=$dbconn->execute($query);
        list($syscount)=$result->fields;
        echo "Tested - $syscount systems";
$query="select count(distinct scantime) from nessus_results where TO_DAYS(now()) - TO_DAYS(scantime) <=30 and username='$username' and falsepositive<>'Y' and scriptid <> 10180 and msg<>''";
        $result=$dbconn->execute($query);
        list($syscount)=$result->fields;
        echo ", $syscount times.";
$query="select count(scantime) from nessus_results where TO_DAYS(now()) - TO_DAYS(scantime) <=30 and username='$username' and falsepositive<>'Y' and scriptid <> 10180 and msg<>''";
        $result=$dbconn->execute($query);
        list($vulncount)=$result->fields;
        echo " Found $vulncount vulnerabilities - averaging ".round($vulncount/$syscount,2)." vulnerabilities per scan.<br><br>";
	echo "<img src='graph2.php?days=365&amp;chart_type=1'><br>";
$query="select count(distinct(host)) from nessus_results TO_DAYS(now()) - TO_DAYS(scantime) <=365 and username='$username' and falsepositive<>'Y' and scriptid <> 10180 and msg<>''";
        $result=$dbconn->execute($query);
        list($syscount)=$result->fields;
        echo "Tested - $syscount systems";
$query="select count(distinct scantime) from nessus_results where TO_DAYS(now()) - TO_DAYS(scantime) <=365 and username='$username' and falsepositive<>'Y' and scriptid <> 10180 and msg<>''";
        $result=$dbconn->execute($query);
        list($syscount)=$result->fields;
        echo ", $syscount times.";
$query="select count(scantime) from nessus_results where TO_DAYS(now()) - TO_DAYS(scantime) <=365 and username='$username' and falsepositive<>'Y' and scriptid <> 10180 and msg<>''";
        $result=$dbconn->execute($query);
        list($vulncount)=$result->fields;
        echo " Found $vulncount vulnerabilities - averaging ".round($vulncount/$syscount,2)." vulnerabilities per scan.<br><br>";

include("footer.php");
?>
