<?php

#
# statistics.php - Management Statistics from Tickets.
#
/*
6/14/11	First version
*/
error_reporting(0);
require_once '../incs/functions.inc.php';
@session_start();
$type = $_GET['type'];
function get_stat_type_type($value)
{
    $stat_type = "Not Used";
    $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}stats_type` WHERE `st_id` = {$value}";
    $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
    if (mysql_num_rows($result) != 0) {
        $row = stripslashes_deep(mysql_fetch_assoc($result));
        $stat_type = $row['stat_type'];
    }
    return $stat_type;
}
print json_encode(get_stat_type_type($type));
 $f1 = found_user() ? $row['f1'] : 1;
 $f2 = found_user() ? $row['f2'] : 2;
 $f3 = found_user() ? $row['f3'] : 3;
 $f4 = found_user() ? $row['f4'] : 4;
 $f5 = found_user() ? $row['f5'] : 5;
 $f6 = found_user() ? $row['f6'] : 6;
 $f7 = found_user() ? $row['f7'] : 7;
 $f8 = found_user() ? $row['f8'] : 8;
 $type1 = get_stat_type_type($f1);
 $type2 = get_stat_type_type($f2);
 $type3 = get_stat_type_type($f3);
 $type4 = get_stat_type_type($f4);
 $type5 = get_stat_type_type($f5);
 $type6 = get_stat_type_type($f6);
 $type7 = get_stat_type_type($f7);
 $type8 = get_stat_type_type($f8);
 $t1 = found_user() ? $row['threshold_1'] : 0;
 $t2 = found_user() ? $row['threshold_2'] : 0;
 $t3 = found_user() ? $row['threshold_3'] : 0;
 $t4 = found_user() ? $row['threshold_4'] : 0;
 $t5 = found_user() ? $row['threshold_5'] : 0;
 $t6 = found_user() ? $row['threshold_6'] : 0;
 $t7 = found_user() ? $row['threshold_7'] : 0;
 $t8 = found_user() ? $row['threshold_8'] : 0;
 $tw1 = found_user() ? $row['thresholdw_1'] : 0;
 $tw2 = found_user() ? $row['thresholdw_2'] : 0;
 $tw3 = found_user() ? $row['thresholdw_3'] : 0;
 $tw4 = found_user() ? $row['thresholdw_4'] : 0;
 $tw5 = found_user() ? $row['thresholdw_5'] : 0;
 $tw6 = found_user() ? $row['thresholdw_6'] : 0;
 $tw7 = found_user() ? $row['thresholdw_7'] : 0;