index.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. error_reporting(NULL);
  3. $TAB = 'SERVER';
  4. // Main include
  5. include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
  6. // Check user
  7. if ($_SESSION['user'] != 'admin') {
  8. header("Location: /list/user");
  9. exit;
  10. }
  11. // CPU info
  12. if (isset($_GET['cpu'])) {
  13. $TAB = 'CPU';
  14. include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_server_info.html');
  15. exec (VESTA_CMD.'v-list-sys-cpu-status', $output, $return_var);
  16. foreach($output as $file) {
  17. echo $file . "\n";
  18. }
  19. echo " </pre>\n</body>\n</html>\n";
  20. exit();
  21. }
  22. // Memory info
  23. if (isset($_GET['mem'])) {
  24. $TAB = 'MEMORY';
  25. include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_server_info.html');
  26. exec (VESTA_CMD.'v-list-sys-memory-status', $output, $return_var);
  27. foreach($output as $file) {
  28. echo $file . "\n";
  29. }
  30. echo " </pre>\n</body>\n</html>\n";
  31. exit();
  32. }
  33. // Disk info
  34. if (isset($_GET['disk'])) {
  35. $TAB = 'DISK';
  36. include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_server_info.html');
  37. exec (VESTA_CMD.'v-list-sys-disk-status', $output, $return_var);
  38. foreach($output as $file) {
  39. echo $file . "\n";
  40. }
  41. echo " </pre>\n</body>\n</html>\n";
  42. exit();
  43. }
  44. // Network info
  45. if (isset($_GET['net'])) {
  46. $TAB = 'NETWORK';
  47. include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_server_info.html');
  48. exec (VESTA_CMD.'v-list-sys-network-status', $output, $return_var);
  49. foreach($output as $file) {
  50. echo $file . "\n";
  51. }
  52. echo " </pre>\n</body>\n</html>\n";
  53. exit();
  54. }
  55. // Web info
  56. if (isset($_GET['web'])) {
  57. $TAB = 'WEB';
  58. include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_server_info.html');
  59. exec (VESTA_CMD.'v-list-sys-web-status', $output, $return_var);
  60. foreach($output as $file) {
  61. echo $file . "\n";
  62. }
  63. echo " </pre>\n</body>\n</html>\n";
  64. exit();
  65. }
  66. // DNS info
  67. if (isset($_GET['dns'])) {
  68. $TAB = 'DNS';
  69. include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_server_info.html');
  70. exec (VESTA_CMD.'v-list-sys-dns-status', $output, $return_var);
  71. foreach($output as $file) {
  72. echo $file . "\n";
  73. }
  74. echo " </pre>\n</body>\n</html>\n";
  75. exit();
  76. }
  77. // Mail info
  78. if (isset($_GET['mail'])) {
  79. $TAB = 'MAIL';
  80. include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_server_info.html');
  81. exec (VESTA_CMD.'v-list-sys-mail-status', $output, $return_var);
  82. if ($return_var == 0 ) {
  83. foreach($output as $file) {
  84. echo $file . "\n";
  85. }
  86. }
  87. echo " </pre>\n</body>\n</html>\n";
  88. exit();
  89. }
  90. // DB info
  91. if (isset($_GET['db'])) {
  92. $TAB = 'DB';
  93. include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_server_info.html');
  94. exec (VESTA_CMD.'v-list-sys-db-status', $output, $return_var);
  95. if ($return_var == 0 ) {
  96. foreach($output as $file) {
  97. echo $file . "\n";
  98. }
  99. }
  100. echo " </pre>\n</body>\n</html>\n";
  101. exit();
  102. }
  103. // Header
  104. include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
  105. // Panel
  106. top_panel($user,$TAB);
  107. // Data
  108. exec (VESTA_CMD."v-list-sys-info json", $output, $return_var);
  109. $sys = json_decode(implode('', $output), true);
  110. unset($output);
  111. exec (VESTA_CMD."v-list-sys-services json", $output, $return_var);
  112. $data = json_decode(implode('', $output), true);
  113. unset($output);
  114. include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_services.html');
  115. // Back uri
  116. $_SESSION['back'] = $_SERVER['REQUEST_URI'];
  117. // Footer
  118. include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');