Example #1
0
        break;
    case "prgs":
        $sql = "SELECT COUNT(*) FROM (SELECT DISTINCT name FROM programs) AS result";
        break;
    case "mnes":
        $sql = "SELECT COUNT(*) FROM (SELECT DISTINCT name FROM mne) AS result";
        break;
    case "sevs":
        $sql = "SELECT COUNT(*) FROM (SELECT DISTINCT severity FROM " . $_SESSION['TBL_MAIN'] . ") AS result";
        break;
    case "facs":
        $sql = "SELECT COUNT(*) FROM (SELECT DISTINCT facility FROM " . $_SESSION['TBL_MAIN'] . ") AS result";
        break;
}
if ($spx_sql) {
    $array = spx_query($spx_sql);
    // print_r($array);
    if (is_array($array)) {
        $total = $array[2][1];
        echo intval($total);
    } else {
        echo "{$array}";
    }
} else {
    $result = perform_query($sql, $dbLink, $_SERVER['PHP_SELF']);
    if (num_rows($result) == 0) {
        // echo "ERROR in ajax/counts.php";
        echo 0;
    } else {
        $line = fetch_array($result);
        if ($data == "mps") {
 *
 * Developed by Clayton Dukes <*****@*****.**>
 * Copyright (c) 2010 LogZilla, LLC
 * All rights reserved.
 * Last updated on 2010-06-15
 *
 * Changelog:
 * 2009-12-13 - created
 *
 */

session_start();
$basePath = dirname( __FILE__ );
require_once ($basePath . "/../common_funcs.php");
if ((has_portlet_access($_SESSION['username'], 'Programs') == TRUE) || ($_SESSION['AUTHTYPE'] == "none")) {
    $array = spx_query("select *, count(*) x from distributed group by program order by x desc limit 10");
    for ($i = 1; $i <= count($array); $i++) {
        $id = $array[$i][0];
        switch($id) {
            case 'total':
                $total = $array[$i][1];
                break;
            case 'total_found':
                $total_found = $array[$i][1];
                break;
            case 'time':
                $time = $array[$i][1];
                break;
        }
        $ids[] = $array[$i][0];
        $host_crcs[] = $array[$i][1];