From 3cb334154192126c3b21ba2c0f97171446e223d9 Mon Sep 17 00:00:00 2001 From: Sebastian Hegge Date: Fri, 20 Sep 2019 12:00:55 +0200 Subject: [PATCH] bugfix for local ip detection in chrome --- .gitignore | 3 ++- index.php | 4 ++-- script.js | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 4e9b47a..a00ed6d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -config.php \ No newline at end of file +.ht* +config.php diff --git a/index.php b/index.php index 6dec87e..d181945 100644 --- a/index.php +++ b/index.php @@ -18,7 +18,7 @@ if(strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'curl')!==false){ print($_SERVER['REMOTE_ADDR']."\n"); - if($_SERVER['REMOTE_ADDR'] != gethostbyaddr($_SERVER['REMOTE_ADDR'])){ + if($_SERVER['REMOTE_ADDR'] != gethostbyaddr($_SERVER['REMOTE_ADDR'])){ print(gethostbyaddr($_SERVER['REMOTE_ADDR'])."\n"); } } @@ -168,7 +168,7 @@
- © Sebastian Hegge · Impressum & Datenschutz · Source on GitHub · v1.6 + © Sebastian Hegge · Impressum & Datenschutz · Source on GitHub · v1.7
diff --git a/script.js b/script.js index af75359..965ef4e 100644 --- a/script.js +++ b/script.js @@ -166,7 +166,7 @@ $(document).ready(function(){ function get_dns_data() { var random_string = ''; - for (i = 0; i < 32; i++) { + for (i = 0; i < 32; i++) { random_string += '0123456789abcdefghijklmnopqrstuvwxyz'[Math.round(Math.random() * 35)] } $.ajax({ @@ -247,7 +247,7 @@ $(document).ready(function(){ var addrs = []; function updateDisplay(newAddr) { - if (newAddr != '0.0.0.0' && addrs.indexOf(newAddr) == -1) { + if (newAddr != '0.0.0.0' && addrs.indexOf(newAddr) == -1 && newAddr.indexOf('-') == -1) { addrs.push(newAddr); } $('#content-local-ip').text(addrs.join(', ') || '-');