Exemple #1
0
function parseUrl()
{
    // print_r ($_GET);
    //    $relation[] = checkRelation();
    //    var_dump($relation);
    if (array_key_exists('graph', $_GET)) {
        switch ($_GET['graph']) {
            case 'graph1':
                //$_GET['research'] = 'stat-1';
                //drawGraph1();
                //dependingDefenition();
                drawGraph($_GET['tableName']);
                break;
                //default: {echo "error"; break; }
        }
    }
    if (array_key_exists('data', $_GET)) {
        switch ($_GET['data']) {
            case 'insertGraphics':
                insertGraphics();
                break;
            case 'showTable':
                showTableDependings($_GET['research']);
                break;
                //default: {echo "error"; break; }
        }
    }
}
    $bad[] = $count;
    $count = count($db->searchEntries(SEARCH_FIELD_OFFSET | SEARCH_COMPARE | SEARCH_ARRAY, 4, "<20", null, null, null, 0));
    $stats->addStats($date, Stats::FAST, $count);
    $fast[] = $count;
    $count = count($db->searchEntries(SEARCH_FIELD_OFFSET | SEARCH_ARRAY, 5, 1, null, null, 0));
    $stats->addStats($date, Stats::SSL, $count);
    $ssl[] = $count;
    $count = count($db->searchEntries(SEARCH_FIELD_OFFSET | SEARCH_ARRAY, 8, 0));
    $stats->addStats($date, Stats::GOOD, $count);
    $good[] = $count;
    //$xAxis[] = $i;
    $files[] = sprintf(X_AXIS_FORMAT, $y, $m, $d);
}
print "gathering data for graph took: " . (microtime(true) - $start) . " secs\n";
$start = microtime(true);
drawGraph($files, array($bad, $good, $ssl, $fast));
print "drawing graph took: " . (microtime(true) - $start) . " secs\n";
$start = microtime(true);
$fp = fopen('/usr/local/apache/htdocs/proxy_framework/stats', 'w+');
flock($fp, LOCK_EX);
$udata = new UniqueIPDatabase();
fwrite($fp, $udata->getDatabase()->entryCount() . "\n");
$files = scandir(PF_DIR);
$newfiles = array();
foreach ($files as $file) {
    if (strpos($file, "snapshot") !== false) {
        $newfiles[] = $file;
    }
}
$file = PF_DIR . "/" . $newfiles[count($newfiles) - 1];
$db = new DatabaseImpl($file);
Exemple #3
0
session_start();
//include('functions.php');
// Create some random text-encoded data for a line chart.
//$day = dateToDays('04-22-1988');
$now = time();
$dob = time();
$curr = time();
if (!empty($_POST['dob'])) {
    $dob = strtotime(str_replace('-', '/', $_POST['dob']));
}
if (!empty($_POST['curr'])) {
    $curr = strtotime(str_replace('-', '/', $_POST['curr']));
}
$days = $curr - $dob;
$days = intval(floor($days / (60 * 60 * 24)));
drawGraph($days, $curr);
function drawGraph($days, $curr)
{
    header('content-type: image/png');
    $url = 'http://chart.apis.google.com/chart';
    $day = $days;
    /** 
    Physical 
    **/
    $chd = 't:';
    for ($i = $day - 10; $i <= $day + 10; ++$i) {
        $data = sin(2 * pi() * $i / 23);
        $chd .= $data . ',';
    }
    $chd = substr($chd, 0, -1);
    /**