From 7b3ebbee8a7c02445ce27df421891cb2fd8d01d7 Mon Sep 17 00:00:00 2001 From: gecco Date: Wed, 20 Sep 2017 12:18:40 +0800 Subject: [PATCH 1/2] fix query hostname by gethostname() --- .gitignore | 1 + .idea/.name | 1 - .idea/encodings.xml | 5 - .idea/misc.xml | 5 - .idea/modules.xml | 9 -- .idea/pi-dashboard.iml | 9 -- .idea/scopes/scope_settings.xml | 5 - .idea/vcs.xml | 7 -- .idea/workspace.xml | 176 -------------------------------- d.php => bootstrap.php | 4 +- index.php | 4 +- 11 files changed, 5 insertions(+), 221 deletions(-) create mode 100644 .gitignore delete mode 100644 .idea/.name delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/pi-dashboard.iml delete mode 100644 .idea/scopes/scope_settings.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .idea/workspace.xml rename d.php => bootstrap.php (99%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 55ae199..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -pi-dashboard \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index e206d70..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 1162f43..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 8e25b20..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/.idea/pi-dashboard.iml b/.idea/pi-dashboard.iml deleted file mode 100644 index 6b8184f..0000000 --- a/.idea/pi-dashboard.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml deleted file mode 100644 index 922003b..0000000 --- a/.idea/scopes/scope_settings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index def6a6a..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 7367106..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1504085111730 - 1504085111730 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/d.php b/bootstrap.php similarity index 99% rename from d.php rename to bootstrap.php index 50facaf..806142f 100644 --- a/d.php +++ b/bootstrap.php @@ -21,7 +21,7 @@ if (isset($_GET['ajax']) && $_GET['ajax'] == "true"){ $D['version'] = '1.0.0'; $D['model'] = get_device_model(); $D['user'] = @get_current_user(); -$D['hostname'] = $_SERVER['SERVER_NAME']; +$D['hostname'] = gethostname(); $D['hostip'] = ('/'==DIRECTORY_SEPARATOR) ? $_SERVER['SERVER_ADDR'] : @gethostbyname($_SERVER['SERVER_NAME']); $D['yourip'] = $_SERVER['REMOTE_ADDR']; $D['uname'] = @php_uname(); @@ -175,4 +175,4 @@ function get_info(){ $D['net']['count'] = 0; } } -?> \ No newline at end of file +?> diff --git a/index.php b/index.php index 8849d3f..7f3e5da 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ @@ -248,4 +248,4 @@ require_once(dirname(__FILE__) . '/d.php'); - \ No newline at end of file + From ba70c49daf74362601697669ad7bd34292d2faae Mon Sep 17 00:00:00 2001 From: gecco Date: Wed, 20 Sep 2017 13:03:43 +0800 Subject: [PATCH 2/2] fix mem free --- bootstrap.php => device.php | 2 +- index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename bootstrap.php => device.php (98%) diff --git a/bootstrap.php b/device.php similarity index 98% rename from bootstrap.php rename to device.php index 806142f..85a561a 100644 --- a/bootstrap.php +++ b/device.php @@ -120,7 +120,7 @@ function get_info(){ $D['mem']['used'] = $D['mem']['total']-$D['mem']['free']; $D['mem']['percent'] = (floatval($D['mem']['total'])!=0)?round($D['mem']['used']/$D['mem']['total']*100,2):0; $D['mem']['real']['used'] = $D['mem']['total'] - $D['mem']['free'] - $D['mem']['cached'] - $D['mem']['buffers']; - $D['mem']['real']['free'] = $D['mem']['total'] - $D['mem']['real']['used']; + $D['mem']['real']['free'] = round($D['mem']['total'] - $D['mem']['real']['used'],2); $D['mem']['real']['percent'] = (floatval($D['mem']['total'])!=0)?round($D['mem']['real']['used']/$D['mem']['total']*100,2):0; $D['mem']['swap']['total'] = round($buf[4][0]/1024, 2); $D['mem']['swap']['free'] = round($buf[5][0]/1024, 2); diff --git a/index.php b/index.php index 7f3e5da..2f348f5 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@