Example #1
0
            }
        }
    }
} elseif ($privateInstall || $admin) {
    $total_api = 0;
    $total_ui = 0;
    echo "<table class=\"table\"><tr><th>Date</th><th>Interactive</th><th>API</th><th>Total</th></tr>" . PHP_EOL;
    $targetDate = new DateTime('now', new DateTimeZone('GMT'));
    for ($offset = 0; $offset <= $days; $offset++) {
        // figure out the name of the log file
        $fileName = './logs/' . $targetDate->format("Ymd") . '.log';
        $file = file($fileName);
        $api = 0;
        $ui = 0;
        foreach ($file as &$line) {
            $parts = tokenizeLogLine($line);
            if (array_key_exists('key', $parts) && strlen($parts['key'])) {
                $api++;
            } else {
                $ui++;
            }
        }
        $count = $api + $ui;
        $date = $targetDate->format("Y/m/d");
        echo "<tr><td>{$date}</td><td>{$ui}</td><td>{$api}</td><td>{$count}</td></tr>\n";
        $targetDate->modify('-1 day');
        $total_api += $api;
        $total_ui += $ui;
        flush();
        ob_flush();
    }
Example #2
0
     }
     $lines = explode("\n", $file);
     unset($file);
 }
 if (count($lines) && $ok) {
     // walk through them backwards
     $records = array_reverse($lines);
     unset($lines);
     foreach ($records as $line) {
         $ok = true;
         if ($filterstr && stristr($line, $filterstr) === false) {
             $ok = false;
         }
         if ($ok) {
             // tokenize the line
             $line_data = tokenizeLogLine($line);
             $date = $line_data['date'];
             $ip = $line_data['ip'];
             $guid = $line_data['guid'];
             $url = htmlentities($line_data['url']);
             $location = $line_data['location'];
             $private = $line_data['private'];
             $testUID = $line_data['testUID'];
             $testUser = $line_data['testUser'];
             $video = $line_data['video'];
             $label = htmlentities($line_data['label']);
             $o = $line_data['o'];
             $key = $line_data['key'];
             $count = $line_data['count'];
             if (!$location) {
                 $location = '';