aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/rrd.php
blob: 58614a0f93f3f704de0a583fa8c0e3c9f0442e1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php

require_once 'conf/common.inc.php';
require_once 'inc/functions.inc.php';
require_once 'inc/html.inc.php';

if ($file = validateRRDPath($CONFIG['datadir'], $_GET['path'])) {
	header('Content-Type: application/octet-stream');
	header('Content-Disposition: attachment; filename='.basename($file));
	header("Expires: " .date(DATE_RFC822,strtotime($CONFIG['cache']." seconds")));
    ob_clean();
    flush();
    readfile($file);
} else {
	header('HTTP/1.0 403 Forbidden');

	html_start();
	echo <<<EOT
<h2>Forbidden</h2>
<p><a href="{$CONFIG['weburl']}">Return home...</a></p>

EOT;
	html_end();
}