setselfaddress
This commit is contained in:
parent
fe5f066621
commit
0999209e5b
@ -329,3 +329,19 @@ function sendExceptionMail($e)
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
function get_client_ip() {
|
||||
if (getenv('HTTP_CLIENT_IP')) return getenv('HTTP_CLIENT_IP');
|
||||
else if(getenv('HTTP_X_FORWARDED_FOR')) return getenv('HTTP_X_FORWARDED_FOR');
|
||||
else if(getenv('HTTP_X_FORWARDED')) return getenv('HTTP_X_FORWARDED');
|
||||
else if(getenv('HTTP_FORWARDED_FOR')) return getenv('HTTP_FORWARDED_FOR');
|
||||
else if(getenv('HTTP_FORWARDED')) return getenv('HTTP_FORWARDED');
|
||||
else if(getenv('REMOTE_ADDR')) return getenv('REMOTE_ADDR');
|
||||
else if (isset($_SERVER['HTTP_CLIENT_IP'])) return $_SERVER['HTTP_CLIENT_IP'];
|
||||
else if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) return $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
else if(isset($_SERVER['HTTP_X_FORWARDED'])) return $_SERVER['HTTP_X_FORWARDED'];
|
||||
else if(isset($_SERVER['HTTP_FORWARDED_FOR'])) return $_SERVER['HTTP_FORWARDED_FOR'];
|
||||
else if(isset($_SERVER['HTTP_FORWARDED'])) return $_SERVER['HTTP_FORWARDED'];
|
||||
else if(isset($_SERVER['REMOTE_ADDR'])) return $_SERVER['REMOTE_ADDR'];
|
||||
else return 'UNKNOWN';
|
||||
}
|
@ -88,6 +88,24 @@ function dumpConsistency($c) {
|
||||
|
||||
<!------------------------------------------>
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Self IP Addr</div>
|
||||
|
||||
<?php
|
||||
$ippath = __DIR__ . '/../dynamic/self_ip_address.auto.cfg';
|
||||
$self_ip = file_exists($ippath) ? file_get_contents($ippath) : 'N/A';
|
||||
$real_ip = get_client_ip();
|
||||
$me = $real_ip == $self_ip
|
||||
?>
|
||||
|
||||
<div class="bc_data keyvaluelist kvl_200">
|
||||
<div><span>Registered IP:</span> <span><?php echo $self_ip; ?></span></div>
|
||||
<div><span>Current IP:</span> <span><?php echo $real_ip; ?></span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!------------------------------------------>
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">ExtendedGitGraph</div>
|
||||
|
||||
|
@ -1,21 +1,9 @@
|
||||
<?php
|
||||
|
||||
function get_client_ip() {
|
||||
if (getenv('HTTP_CLIENT_IP')) return getenv('HTTP_CLIENT_IP');
|
||||
else if(getenv('HTTP_X_FORWARDED_FOR')) return getenv('HTTP_X_FORWARDED_FOR');
|
||||
else if(getenv('HTTP_X_FORWARDED')) return getenv('HTTP_X_FORWARDED');
|
||||
else if(getenv('HTTP_FORWARDED_FOR')) return getenv('HTTP_FORWARDED_FOR');
|
||||
else if(getenv('HTTP_FORWARDED')) return getenv('HTTP_FORWARDED');
|
||||
else if(getenv('REMOTE_ADDR')) return getenv('REMOTE_ADDR');
|
||||
else if (isset($_SERVER['HTTP_CLIENT_IP'])) return $_SERVER['HTTP_CLIENT_IP'];
|
||||
else if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) return $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
else if(isset($_SERVER['HTTP_X_FORWARDED'])) return $_SERVER['HTTP_X_FORWARDED'];
|
||||
else if(isset($_SERVER['HTTP_FORWARDED_FOR'])) return $_SERVER['HTTP_FORWARDED_FOR'];
|
||||
else if(isset($_SERVER['HTTP_FORWARDED'])) return $_SERVER['HTTP_FORWARDED'];
|
||||
else if(isset($_SERVER['REMOTE_ADDR'])) return $_SERVER['REMOTE_ADDR'];
|
||||
else return 'UNKNOWN';
|
||||
}
|
||||
$ip = get_client_ip();
|
||||
|
||||
//TODO setSelfAdress
|
||||
file_put_contents(__DIR__ . '/../dynamic/self_ip_address.auto.cfg', $ip);
|
||||
|
||||
system('add-trusted-ip "' . $ip . '"');
|
||||
|
||||
echo 'Ok.';
|
||||
|
Loading…
Reference in New Issue
Block a user