add a LICENSE and a README to things are all nice at GitHub :)
[php-utility-classes.git] / examples / rrd / rrd-stat.php
CommitLineData
4a778b7e 1<?php
1759d73b 2date_default_timezone_set("Europe/Vienna");
4a778b7e 3$myfile = $_SERVER['SCRIPT_FILENAME'];
4while (is_link($myfile)) { $myfile = readlink($myfile); }
5if (getcwd() != dirname($myfile)) {
6 // change to directory of the script if called from different directory
7 $orig_workingdir = getcwd();
8 chdir(dirname($myfile));
9}
10
11include_once('rrdstat.php-class');
4d8d65db 12
ac51fa8e
RK
13// $GLOBALS['ua'] is required by some page generation routines
14include_once('useragent.php-class');
15$ua = new userAgent();
16
4d8d65db
RK
17$rrd_config_file = 'rrd-config/'.php_uname('n').'.inc.php';
18if (!file_exists($rrd_config_file)) { $rrd_config_file = 'rrd-config.inc.php'; }
19include_once($rrd_config_file);
4a778b7e 20
21// view stats
22$sname = isset($_GET['stat'])?$_GET['stat']:null;
23if (is_null($sname) || !strlen($sname)) { $sname = 'index'; }
24
25// call RRD module
26$rrds = new rrdstat($rrd_info, $sname);
27
28$psub = isset($_GET['sub'])?$_GET['sub']:null;
29print($rrds->page($psub));
30?>