Some experimenting

This commit is contained in:
dqos 2023-03-25 16:05:50 +01:00
parent 41adb719f8
commit 10d9568289
2 changed files with 3 additions and 4 deletions

View File

@ -448,7 +448,7 @@ class LookingGlass
preg_match('/\d+\.\d+\.\d+\.\d+/', $explodedsocket[2], $temp);
if (!isset($temp[0])) {
continue;
} // when thsi cantt be filled just continue
}
$sock['local'] = $temp[0];
preg_match('/\d+\.\d+\.\d+\.\d+/', $explodedsocket[3], $temp);
$sock['remote'] = $temp[0];

View File

@ -77,7 +77,7 @@ if (LG_BLOCK_CUSTOM) {
$templateData['custom_html'] = ob_get_clean();
}
if (LG_CHECK_LATENCY) {
if (LG_CHECK_LATENCY && filter_var(LookingGlass::detectIpAddress(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
$templateData['latency'] = LookingGlass::getLatency();
}
@ -166,9 +166,8 @@ $templateData['csrfToken'] = $_SESSION[LookingGlass::SESSION_CSRF] = bin2hex(ran
<div class="col-md-4">
<label class="mb-2 text-muted">Your IP</label>
<div class="input-group">
<?php if (LG_CHECK_LATENCY): ?><label class="input-group-text" title="Latency between this looking glass and your connection." style="cursor: help;"><?php echo $templateData['latency'] ?> ms</label><?php endif ?>
<input type="text" class="form-control" value="<?php echo $templateData['user_ip'] ?>" onfocus="this.select()" readonly="">
<button class="btn btn-outline-secondary" onclick="copyToClipboard('<?php echo $templateData['user_ip'] ?>', this)">Copy</button>
<?php if (LG_CHECK_LATENCY && filter_var(LookingGlass::detectIpAddress(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)): ?><label class="input-group-text" title="Latency between this looking glass and your connection." style="cursor: help;"><small><?php echo $templateData['latency'] ?> MS</small></label><?php endif ?>
</div>
</div>
</div>