forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajax.php
More file actions
32 lines (28 loc) · 770 Bytes
/
ajax.php
File metadata and controls
32 lines (28 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
use function Hestiacp\quoteshellarg\quoteshellarg;
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check user
if ($_SESSION['userContext'] != 'admin') {
header('Location: /list/user');
exit;
}
if (empty($_POST['period'])) {
$period = "daily";
} else {
if (in_array($_POST['period'] ,array('day', 'week','month','year'))) {
$period=$_POST['period'];
} else {
$period = "daily";
}
}
if (empty($_POST['service'])) {
$service = "la";
} else {
$service = $_POST['service'];
}
// Data
exec(HESTIA_CMD."v-export-rrd ".quoteshellarg($service)." ".quoteshellarg($period), $output, $return_var);
$data = json_decode(implode('', $output), true);
$data['service'] = $service;
echo json_encode($data);