index.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. error_reporting(NULL);
  3. $TAB = 'STATS';
  4. // Main include
  5. include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
  6. // Header
  7. include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
  8. // Panel
  9. top_panel($user,$TAB);
  10. // Data
  11. if ($user == 'admin') {
  12. if (empty($_GET['user'])) {
  13. v_exec('v-list-users-stats', ['json'], false, $output);
  14. $data = json_decode($output, true);
  15. $data = array_reverse($data, true);
  16. } else {
  17. $v_user = $_GET['user'];
  18. v_exec('v-list-user-stats', [$v_user, 'json'], false, $output);
  19. $data = json_decode($output, true);
  20. $data = array_reverse($data, true);
  21. }
  22. v_exec('v-list-sys-users', ['json'], false, $output);
  23. $users = json_decode($output, true);
  24. include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_stats.html');
  25. } else {
  26. v_exec('v-list-user-stats', [$user, 'json'], false, $output);
  27. $data = json_decode($output, true);
  28. $data = array_reverse($data, true);
  29. include($_SERVER['DOCUMENT_ROOT'].'/templates/user/list_stats.html');
  30. }
  31. // Back uri
  32. $_SESSION['back'] = $_SERVER['REQUEST_URI'];
  33. // Footer
  34. include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');