index.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. $file=str_replace('border="0"', 'border="1"', $file);
  62. echo $file . "\n";
  63. }
  64. echo " </pre>\n</body>\n</html>\n";
  65. exit();
  66. }
  67. // DNS info
  68. if (isset($_GET['dns'])) {
  69. $TAB = 'DNS';
  70. include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_server_info.html');
  71. exec (VESTA_CMD.'v-list-sys-dns-status', $output, $return_var);
  72. foreach($output as $file) {
  73. echo $file . "\n";
  74. }
  75. echo " </pre>\n</body>\n</html>\n";
  76. exit();
  77. }
  78. // Mail info
  79. if (isset($_GET['mail'])) {
  80. $TAB = 'MAIL';
  81. include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_server_info.html');
  82. exec (VESTA_CMD.'v-list-sys-mail-status', $output, $return_var);
  83. if ($return_var == 0 ) {
  84. foreach($output as $file) {
  85. echo $file . "\n";
  86. }
  87. }
  88. echo " </pre>\n</body>\n</html>\n";
  89. exit();
  90. }
  91. // DB info
  92. if (isset($_GET['db'])) {
  93. $TAB = 'DB';
  94. include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_server_info.html');
  95. exec (VESTA_CMD.'v-list-sys-db-status', $output, $return_var);
  96. if ($return_var == 0 ) {
  97. foreach($output as $file) {
  98. echo $file . "\n";
  99. }
  100. }
  101. echo " </pre>\n</body>\n</html>\n";
  102. exit();
  103. }
  104. // Data
  105. exec (VESTA_CMD."v-list-sys-info json", $output, $return_var);
  106. $sys = json_decode(implode('', $output), true);
  107. unset($output);
  108. exec (VESTA_CMD."v-list-sys-services json", $output, $return_var);
  109. $data = json_decode(implode('', $output), true);
  110. unset($output);
  111. // Render page
  112. render_page($user, $TAB, 'list_services');
  113. // Back uri
  114. $_SESSION['back'] = $_SERVER['REQUEST_URI'];