<?php

if (!empty($_REQUEST['graphmethod'])) {
    include_once(
'LastXgraph.php');

    if (
$_REQUEST['graphmethod'] == '24hourdistribution') {

        
// this just fills in some default sample data for a 24-h distribution
        
srand(time());
        for (
$i 0$i <= 23$i++) {
            for (
$j 1$j <= 1$j++) {
                
$data['Key'.$j][$i] = rand(01000);
            }
        }
        
$title       'Sample 24-h Distribution Graph';
        
$scalelabel  'items / day';

        
LastXgraph($data$_REQUEST['graphmethod'], $title$scalelabel);
        exit;

    } elseif (
$_REQUEST['graphmethod'] == 'pastxdays') {

        
// this just fills in some default sample data for a past-x-days graph
        
srand(time());
        for (
$i 0$i <= 30$i++) {
            for (
$j 1$j <= 2$j++) {
                
$data['Key'.$j][$i] = rand(01000);
            }
        }

        
$title       'Past-X-Days Sample Graph';
        
$scalelabel  'items / day';

        
LastXgraph($data$_REQUEST['graphmethod'], $title$scalelabel);
        exit;

    } elseif (
$_REQUEST['graphmethod'] == 'pastxmonths') {

        
// this just fills in some default sample data for a past-x-months graph
        
srand(time());
        for (
$i 0$i <= 15$i++) {
            for (
$j 1$j <= 2$j++) {
                
$data['Key'.$j][$i] = rand(01000);
            }
        }

        
$title       'Past-X-Months Sample Graph';
        
$scalelabel  'items / month';

        
LastXgraph($data$_REQUEST['graphmethod'], $title$scalelabel);
        exit;

    } elseif (
substr($_REQUEST['graphmethod'], 0strlen('specificmonth')) == 'specificmonth') {

        
$LastDayOfMonth date('j'mktime(1200substr($_REQUEST['graphmethod'], strlen('specificmonth') + 42) + 10substr($_REQUEST['graphmethod'], strlen('specificmonth'), 4)));
        
// this just fills in some default sample data for a specific-month graph
        
srand(time());
        for (
$i 0$i $LastDayOfMonth$i++) {
            for (
$j 1$j <= 2$j++) {
                
$data['Key'.$j][$i] = rand(01000);
            }
        }

        
$title       'Specific Month Sample Graph';
        
$scalelabel  'items / day';

        
LastXgraph($data$_REQUEST['graphmethod'], $title$scalelabel);
        exit;

    } elseif (
substr($_REQUEST['graphmethod'], 0strlen('specificyear')) == 'specificyear') {

        
// this just fills in some default sample data for a specific-year graph
        
srand(time());
        for (
$i 0$i 12$i++) {
            for (
$j 1$j <= 2$j++) {
                
$data['Key'.$j][$i] = rand(01000);
            }
        }

        
$title       'Specific Year Sample Graph';
        
$scalelabel  'items / month';

        
LastXgraph($data$_REQUEST['graphmethod'], $title$scalelabel);
        exit;

    }
}

echo 
'<A HREF="'.$_SERVER['PHP_SELF'].'?graphmethod=24hourdistribution">24-hour-distribution</A><BR>';
echo 
'<A HREF="'.$_SERVER['PHP_SELF'].'?graphmethod=pastxdays">Past-X-Days</A><BR>';
echo 
'<A HREF="'.$_SERVER['PHP_SELF'].'?graphmethod=pastxmonths">Past-X-Months</A><BR>';
echo 
'<A HREF="'.$_SERVER['PHP_SELF'].'?graphmethod=specificmonth'.date('Ym'mktime(1200date('n') - 115date('Y'))).'">Specific Month</A><BR>';
echo 
'<A HREF="'.$_SERVER['PHP_SELF'].'?graphmethod=specificyear'.date('Y').'">Specific Year</A><BR>';

?>