Location: PHPKode > projects > Gateway Anti-Virus > gatewayav-4.1/src/VirusCheckStats.php
<?php
/*
 * gatewayav - an anti-virus web service.
 * Copyright (C) 2007, 2008 Vermont Department of Taxes
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Contributor(s):
 *   Tom Cort <hide@address.com>
 */

require_once('./config.php');
require_once('./lib/adodb5/adodb-exceptions.inc.php');
require_once('./lib/adodb5/adodb.inc.php');
require_once('./lib/db.php');
require_once('./lib/aidan/function.size_readable.php');

db_connect();
$scantime_min = db_scantime_min();
$scantime_avg = db_scantime_avg();
$scantime_max = db_scantime_max();
$memusage_min = size_readable(db_memusage_min());
$memusage_avg = size_readable(db_memusage_avg());
$memusage_max = size_readable(db_memusage_max());
$filesize_min = size_readable(db_filesize_min());
$filesize_avg = size_readable(db_filesize_avg());
$filesize_max = size_readable(db_filesize_max());
$filesize_sum = size_readable(db_filesize_sum());
$first_scan = db_first_scan();
$last_scan = db_last_scan();
$scans_performed = db_scans_performed();
$viruses_found = db_viruses_found();
$viruses_found_pct = db_viruses_found_pct();
$errors = db_recent_errors();
$virus_table = db_virus_table();
db_disconnect();

if (!$scans_per_day_min) { $scans_per_day_min = 0; }
if (!$scans_per_day_max) { $scans_per_day_max = 0; }

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <!--
    /*
     * gatewayav - an anti-virus web service.
     * Copyright (C) 2007 Vermont Department of Taxes
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License version 2 as
     * published by the Free Software Foundation.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program; if not, write to the Free Software
     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     *
     * Contributor(s):
     *   Tom Cort <hide@address.com>
     */
    -->
    <title>Gateway Anti-Virus Stats</title>
    <meta http-equiv="Content-Language" content="English" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" type="text/css" href="css/style.css" media="screen" />
  </head>
  <body>
    <div id="header">
      Gateway Anti-Virus Statistics
    </div>
    <div id="container">
      <div id="content">
        <p>
          Of the <?php echo htmlspecialchars($scans_performed); ?> files (<?php echo htmlspecialchars($filesize_sum); ?>) scanned since <?php echo htmlspecialchars($first_scan); ?>,
          <?php echo htmlspecialchars($viruses_found); ?> files were found to contain at least one virus, phishing attempt, phishing URL or scam.
          This gives an overall infection rate of <?php echo htmlspecialchars($viruses_found_pct); ?>%.
          The average size of a scanned file is <?php echo htmlspecialchars($filesize_avg); ?>.
          The smallest file ever scanned was <?php echo htmlspecialchars($filesize_min); ?>. The largest file ever scanned was
          <?php echo htmlspecialchars($filesize_max); ?>. The average time needed to scan a single file is
          <?php echo htmlspecialchars($scantime_avg); ?> seconds. The longest scan ever took <?php echo htmlspecialchars($scantime_max); ?> seconds.
          The shortest scan ever took <?php echo htmlspecialchars($scantime_min); ?> seconds. The average memory used to complete a scan
          is <?php echo htmlspecialchars($memusage_avg); ?>. The most memory ever used to complete a scan was <?php echo htmlspecialchars($memusage_max); ?>.
          The least memory ever used to complete a scan was <?php echo htmlspecialchars($memusage_min); ?>.
        </p>
        <?php if ($virus_table && count($virus_table) > 0) { ?>
          <table border="0" width="100%">
            <tr><th colspan="5">Viruses Detected</th></tr>
            <tr><th>Virus Name</th><th>First Seen</th><th>Last Seen</th><th>Count (%)</th></tr>
            <?php foreach ($virus_table as $row) { ?>
              <tr><td><?php echo htmlspecialchars($row["name"]); ?></td><td align="center"><?php echo htmlspecialchars($row["first_seen"]); ?></td><td align="center"><?php echo htmlspecialchars($row["last_seen"]); ?></td><td align="center"><?php echo htmlspecialchars($row["count"]); ?> (<?php echo htmlspecialchars(round($row["pct"],2)); ?>%)</td></tr>
            <?php } ?>
          </table>
        <?php } ?>
        <br/>
        <?php if ($errors && count($errors) > 0) { ?>
          <table border="0" width="100%">
            <tr><th colspan="3">Recent Errors</th></tr>
            <?php foreach ($errors as $dtime => $error) { ?>
            <tr><td align="center"><tt><?php echo htmlspecialchars($dtime); ?></tt></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td valign="top" align="left"><?php echo htmlspecialchars($error); ?></td></tr>
            <?php } ?>
          </table>
        <?php } ?>
      </div>
    </div>
    <div id="footer">
      Powered by <a href="http://freshmeat.net/projects/gatewayav/">Gateway Anti-Virus</a><br/>
      <a href="http://www.php.net/">PHP</a> /
      <a href="http://sourceforge.net/projects/nusoap">NuSOAP</a> /
      <a href="http://adodb.sourceforge.net/">ADOdb</a> /
      <a href="http://www.clamav.net/">ClamAV</a>
  </body>
</html>
Return current item: Gateway Anti-Virus