os.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /*
  3. *
  4. * OGP - Open Game Panel
  5. * Copyright (C) 2008 - 2018 The OGP Development Team
  6. *
  7. * http://www.opengamepanel.org/
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. *
  23. */
  24. include_once ("modules/status/config.php");
  25. global $db;
  26. $cygwin = FALSE;
  27. if( isset($_GET['remote_server_id']) AND $_GET['remote_server_id'] != "webhost" ) {
  28. $rhost_id = $_GET['remote_server_id'];
  29. $remote_server = $db->getRemoteServer($rhost_id);
  30. require_once('includes/lib_remote.php');
  31. $remote = new OGPRemoteLibrary($remote_server['agent_ip'], $remote_server['agent_port'], $remote_server['encryption_key'], $remote_server['timeout']);
  32. $os_string = $remote->what_os();
  33. if( preg_match("/Linux/", $os_string) ) {
  34. $os = "linux";
  35. $goodforuptime = "1";
  36. if( preg_match("/64/", $os_string) )
  37. $osbuild = "64bit";
  38. else
  39. $osbuild = "32bit";
  40. }elseif( preg_match("/CYGWIN/", $os_string) ) {
  41. $os = "linux";
  42. $cygwin = TRUE;
  43. if( preg_match("/64/", $os_string) )
  44. $osbuild = "64bit";
  45. else
  46. $osbuild = "32bit";
  47. } else {
  48. $modulecpu = "0";
  49. $modulememory = "0";
  50. $modulestorage = "0";
  51. $modulesystemuptime = "0";
  52. }
  53. } elseif (PHP_OS == "WINNT") {
  54. $os = "windows";
  55. $osbuild = php_uname('v');
  56. } elseif (PHP_OS == "Linux") {
  57. $os = "linux";
  58. $goodforuptime = "1";
  59. $osbuild = php_uname('r');
  60. } elseif(PHP_OS == "CYGWIN") {
  61. $os = "linux";
  62. $cygwin = TRUE;
  63. $goodforuptime = "1";
  64. $osbuild = php_uname('r');
  65. } else {
  66. $os = "nocpu";
  67. $osbuild = php_uname('r');
  68. }
  69. ?>