index.php 876 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. if (empty($_GET['user'])) {
  3. $_GET['user'] = '';
  4. }
  5. if ($_GET['user'] === 'system') {
  6. $TAB = 'SERVER';
  7. } else {
  8. $TAB = 'LOG';
  9. }
  10. // Main include
  11. include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
  12. // Redirect non-administrators if they request another user's log
  13. if (($_SESSION['userContext'] !== 'admin') && (!empty($_GET['user']))) {
  14. header('location: /login/');
  15. exit();
  16. }
  17. // Data
  18. if (($_SESSION['userContext'] === "admin") && (!empty($_GET['user']))) {
  19. // Check token
  20. verify_csrf($_GET);
  21. $user=escapeshellarg($_GET['user']);
  22. }
  23. exec(HESTIA_CMD."v-list-user-log $user json", $output, $return_var);
  24. check_error($return_var);
  25. $data = json_decode(implode('', $output), true);
  26. $data = array_reverse($data);
  27. unset($output);
  28. if (empty($_SESSION['look'])) {
  29. $_SESSION['look'] = '';
  30. }
  31. // Render page
  32. render_page($user, $TAB, 'list_log');