<?php

//
// +---------------------------------------------------------------------+
// | phpOpenTracker - The Website Traffic and Visitor Analysis Solution  |
// +---------------------------------------------------------------------+
// | Copyright (c) 2000-2003 Sebastian Bergmann. All rights reserved.    |
// +---------------------------------------------------------------------+
// | This source file is subject to the phpOpenTracker Software License, |
// | Version 1.0, that is bundled with this package in the file LICENSE. |
// | If you did not receive a copy of this file, you may either read the |
// | license online at http://phpOpenTracker.de/license/1_0.txt, or send |
// | a note to license@phpOpenTracker.de, so we can mail you a copy.     |
// +---------------------------------------------------------------------+
//
// $Id: graph.php,v 1.1 2003/09/02 11:18:56 sven_weih Exp $
//
require 'phpOpenTracker.php';
switch ($_GET['what']) {
    case 'access_statistics':
        $time = time();
        phpOpenTracker::plot(array('api_call' => 'access_statistics', 'client_id' => isset($_GET['client_id']) ? $_GET['client_id'] : 1, 'start' => isset($_GET['start']) ? $_GET['start'] : mktime(0, 0, 0, date('m', $time), 1, date('Y', $time)), 'end' => isset($_GET['end']) ? $_GET['end'] : mktime(0, 0, 0, date('m', $time) + 1, 0, date('Y', $time)), 'interval' => isset($_GET['interval']) ? $_GET['interval'] : 'day', 'width' => isset($_GET['width']) ? $_GET['width'] : 640, 'height' => isset($_GET['height']) ? $_GET['height'] : 480));
        break;
}
    $top = true;
    $diagram = substr($diagram, 4);
} else {
    $top = false;
}
if (substr($diagram, 0, 15) == "search_engines:") {
    $top = true;
}
if ($diagram != "") {
    if ($weekdays) {
        $paramArray = array('api_call' => 'nxweekdays', 'what' => $diagram, 'width' => $width, 'height' => $height);
    } else {
        if ($hours) {
            $paramArray = array('api_call' => 'nxhours', 'what' => $diagram, 'width' => $width, 'height' => $height);
        } else {
            if (!$top) {
                $paramArray = array('api_call' => 'nxaccess_statistics', 'width' => $width, 'height' => $height, 'what' => explode(",", $diagram), 'whatcolors' => array(__RED, __BLUE, __YELLOW, __GREEN, _PURPLE));
            } else {
                if ($top) {
                    $paramArray = array('api_call' => 'nxtop', 'width' => $width, 'height' => $height, 'what' => $diagram, 'limit' => 10);
                }
            }
        }
    }
    $constraint = array();
    if (value("spid", "NUMERIC") != "0") {
        $constraint["constraints"] = array('document_string' => value("spid"));
    }
    $paramArray = array_merge($paramArray, $statsinfo->getRangeArray(), $constraint);
    phpOpenTracker::plot($paramArray);
}
Exemple #3
0
require_once 'phpOpenTracker.php';
switch ($_GET['what']) {
    case 'access_statistics':
        $time = time();
        if ($_GET['when'] == "monthly") {
            phpOpenTracker::plot(array('api_call' => 'access_statistics', 'client_id' => isset($_GET['client_id']) ? $_GET['client_id'] : 1, 'range' => 'current_year', 'interval' => 'month', 'mode' => 'line'));
        } elseif ($_GET['when'] == "dayly") {
            phpOpenTracker::plot(array('api_call' => 'access_statistics', 'client_id' => isset($_GET['client_id']) ? $_GET['client_id'] : 1, 'start' => isset($_GET['start']) ? $_GET['start'] : mktime(0, 0, 0, date('m', $time), 1, date('Y', $time)), 'end' => isset($_GET['end']) ? $_GET['end'] : mktime(0, 0, 0, date('m', $time) + 1, 0, date('Y', $time)), 'interval' => isset($_GET['interval']) ? $_GET['interval'] : 'day', 'width' => isset($_GET['width']) ? $_GET['width'] : 640, 'height' => isset($_GET['height']) ? $_GET['height'] : 480));
        } elseif ($_GET['when'] == "hourly") {
            phpOpenTracker::plot(array('api_call' => 'access_statistics', 'client_id' => isset($_GET['client_id']) ? $_GET['client_id'] : 1, 'range' => 'today', 'interval' => 'hour', 'mode' => 'line'));
        }
        break;
    case 'top':
        $types = array('document', 'entry_document', 'exit_document', 'exit_target', 'host', 'referer', 'operating_system', 'user_agent');
        if (isset($_GET['type']) && in_array($_GET['type'], $types)) {
            if (isset($_GET['range']) && $_GET['range'] != "current_day") {
                phpOpenTracker::plot(array('api_call' => 'top', 'client_id' => isset($_GET['client_id']) ? $_GET['client_id'] : 1, 'what' => isset($_GET['type']) ? $_GET['type'] : 'document', 'limit' => isset($_GET['limit']) ? $_GET['limit'] : 20, 'range' => isset($_GET['range']) ? $_GET['range'] : 'current_year'));
            } else {
                phpOpenTracker::plot(array('api_call' => 'top', 'client_id' => isset($_GET['client_id']) ? $_GET['client_id'] : 1, 'what' => isset($_GET['type']) ? $_GET['type'] : 'document', 'limit' => isset($_GET['limit']) ? $_GET['limit'] : 20, 'start' => mktime(0, 0, 0, date('n'), date('j'), date('Y')), 'end' => mktime(23, 59, 59, date('n'), date('j'), date('Y'))));
            }
        }
        break;
    case 'localizer':
        $time = time();
        if (isset($_GET['range']) && $_GET['range'] != "current_day") {
            phpOpenTracker::plot(array('api_call' => 'localizer', 'what' => 'top_localizer', 'client_id' => isset($_GET['client_id']) ? $_GET['client_id'] : 1, 'range' => isset($_GET['range']) ? $_GET['range'] : 'current_year', 'limit' => isset($_GET['limit']) ? $_GET['limit'] : 20));
        } else {
            phpOpenTracker::plot(array('api_call' => 'localizer', 'what' => 'top_localizer', 'client_id' => isset($_GET['client_id']) ? $_GET['client_id'] : 1, 'range' => isset($_GET['range']) ? $_GET['range'] : 'current_year', 'start' => mktime(0, 0, 0, date('n'), date('j'), date('Y')), 'end' => mktime(23, 59, 59, date('n'), date('j'), date('Y'))));
        }
        break;
}