Skip to content

Commit

Permalink
bugfix for local ip detection in chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianhegge committed Sep 20, 2019
1 parent c4ae494 commit 3cb3341
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
config.php
.ht*
config.php
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Expand Down Expand Up @@ -168,7 +168,7 @@
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="card mt-4">
<div class="card-header card-header-no-border text-center">
&copy; Sebastian Hegge &middot; <a href="https://heg.ge/impressum" target="_blank">Impressum & Datenschutz</a> &middot; <a href="https://github.com/sebastianhegge/iptest" target="_blank">Source on GitHub</a> &middot; v1.6
&copy; Sebastian Hegge &middot; <a href="https://heg.ge/impressum" target="_blank">Impressum & Datenschutz</a> &middot; <a href="https://github.com/sebastianhegge/iptest" target="_blank">Source on GitHub</a> &middot; v1.7
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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(', ') || '-');
Expand Down

0 comments on commit 3cb3341

Please sign in to comment.