mirror of
https://git.terrot.net/terrot.net/checkip.git
synced 2023-08-25 13:53:09 +02:00
fix #1 : le principal
This commit is contained in:
parent
2a5e85fb73
commit
fd023db350
61
index.php
Normal file
61
index.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php ?>
|
||||
<html>
|
||||
<head>
|
||||
<Title>Current IP Check</title>
|
||||
</head>
|
||||
<?php
|
||||
|
||||
// Function to get the client ip address
|
||||
function get_client_ip_env() {
|
||||
$ipaddress = '';
|
||||
if (getenv('HTTP_CLIENT_IP'))
|
||||
$ipaddress = getenv('HTTP_CLIENT_IP');
|
||||
else if(getenv('HTTP_X_FORWARDED_FOR'))
|
||||
$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
|
||||
else if(getenv('HTTP_X_FORWARDED'))
|
||||
$ipaddress = getenv('HTTP_X_FORWARDED');
|
||||
else if(getenv('HTTP_FORWARDED_FOR'))
|
||||
$ipaddress = getenv('HTTP_FORWARDED_FOR');
|
||||
else if(getenv('HTTP_FORWARDED'))
|
||||
$ipaddress = getenv('HTTP_FORWARDED');
|
||||
else if(getenv('REMOTE_ADDR'))
|
||||
$ipaddress = getenv('REMOTE_ADDR');
|
||||
else
|
||||
$ipaddress = 'UNKNOWN';
|
||||
|
||||
return $ipaddress;
|
||||
}
|
||||
|
||||
|
||||
// Function to get the client ip address
|
||||
function get_client_ip_server() {
|
||||
$ipaddress = '';
|
||||
if ($_SERVER['HTTP_CLIENT_IP'])
|
||||
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
|
||||
else if($_SERVER['HTTP_X_FORWARDED_FOR'])
|
||||
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
else if($_SERVER['HTTP_X_FORWARDED'])
|
||||
$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
|
||||
else if($_SERVER['HTTP_FORWARDED_FOR'])
|
||||
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
|
||||
else if($_SERVER['HTTP_FORWARDED'])
|
||||
$ipaddress = $_SERVER['HTTP_FORWARDED'];
|
||||
else if($_SERVER['REMOTE_ADDR'])
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
else
|
||||
$ipaddress = 'UNKNOWN';
|
||||
|
||||
return $ipaddress;
|
||||
}
|
||||
|
||||
// Get the client ip address
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
?>
|
||||
<body>
|
||||
<?php
|
||||
//echo 'Your IP address (using $_SERVER[\'REMOTE_ADDR\']) is ' . $ipaddress . '<br />';
|
||||
//echo 'Your IP address (using get_client_ip_env function) is ' . get_client_ip_env() . '<br />';
|
||||
echo 'Current IP Address: ' . get_client_ip_server();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user