From 254a0f8702fc879867e4590a1ce7f236f588518b Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Mon, 23 May 2022 17:04:46 +0200
Subject: [PATCH] update admin: detect own external ip

---
 public_html/admin/index.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/public_html/admin/index.php b/public_html/admin/index.php
index edd4138..d07c436 100644
--- a/public_html/admin/index.php
+++ b/public_html/admin/index.php
@@ -37,6 +37,11 @@ if (!$oR->isEnabled()){
 } else {
 
     $sUrl=(isset($_GET['url']) && $_GET['url']) ? $sUrl=$_GET['url'] : '';
+    $sMyIp=gethostbyname(gethostname($_SERVER['SERVER_NAME']));
+
+    if(!$sMyIp){
+        $sErrors.='<li>Ip address of current host ['.$_SERVER['SERVER_NAME'].'] was not found.</li>';
+    }
 
     // ---------- GET CONFIG DATA
 
@@ -51,7 +56,7 @@ if (!$oR->isEnabled()){
 
     // ---------- LOOP OVER ALL ENTRIES
 
-    $sMyIp=gethostbyname(gethostname());
+
     $sHtml.='
     <h2>✔️ Http head tester</h2>
     <div class="content">
-- 
GitLab