index.php 820 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. $TAB = "RRD";
  3. // Main include
  4. include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
  5. // Check user
  6. if ($_SESSION["userContext"] != "admin") {
  7. header("Location: /list/user");
  8. exit();
  9. }
  10. // Data
  11. exec(HESTIA_CMD . "v-list-sys-rrd json", $output, $return_var);
  12. $data = json_decode(implode("", $output), true);
  13. unset($output);
  14. /*
  15. if (empty($_GET["period"])) {
  16. $period = "day";
  17. } elseif (!in_array($_GET["period"], ["day", "week", "month", "year"])) {
  18. $period = "day";
  19. } else {
  20. $period = $_GET["period"];
  21. }
  22. */
  23. if (empty($_GET["period"])) {
  24. $period = "daily";
  25. } elseif (!in_array($_GET["period"], ["daily", "weekly", "monthly", "yearly"])) {
  26. $period = "daily";
  27. } else {
  28. $period = $_GET["period"];
  29. }
  30. // Render page
  31. render_page($user, $TAB, "list_rrd");
  32. // Back uri
  33. $_SESSION["back"] = $_SERVER["REQUEST_URI"];