diff options
author | 2021-12-27 17:11:18 +0100 | |
---|---|---|
committer | 2021-12-27 17:11:18 +0100 | |
commit | ef7dfae9d3c94ff6aa620922e1524e8c3c0c8972 (patch) | |
tree | 830d3c8aeb631f583247b6eed54533ec7ea99bdd | |
parent | 14986cd556dc31a4f9636e7819171ea6fed7a30b (diff) | |
download | website-ef7dfae9d3c94ff6aa620922e1524e8c3c0c8972.tar.gz website-ef7dfae9d3c94ff6aa620922e1524e8c3c0c8972.zip |
Add ip.rhtml.php
-rw-r--r-- | ip.rhtml.php | 22 | ||||
-rw-r--r-- | ip.rhtml.php.config | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/ip.rhtml.php b/ip.rhtml.php new file mode 100644 index 0000000..5b0a3e0 --- /dev/null +++ b/ip.rhtml.php @@ -0,0 +1,22 @@ +<?php +// Function to get the client IP address +function get_client_ip() { + $ipaddress = ''; + if (isset($_SERVER['HTTP_CLIENT_IP'])) + $ipaddress = $_SERVER['HTTP_CLIENT_IP']; + else if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) + $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR']; + else if(isset($_SERVER['HTTP_X_FORWARDED'])) + $ipaddress = $_SERVER['HTTP_X_FORWARDED']; + else if(isset($_SERVER['HTTP_FORWARDED_FOR'])) + $ipaddress = $_SERVER['HTTP_FORWARDED_FOR']; + else if(isset($_SERVER['HTTP_FORWARDED'])) + $ipaddress = $_SERVER['HTTP_FORWARDED']; + else if(isset($_SERVER['REMOTE_ADDR'])) + $ipaddress = $_SERVER['REMOTE_ADDR']; + else + $ipaddress = 'UNKNOWN'; + return $ipaddress; +} + +echo get_client_ip();
\ No newline at end of file diff --git a/ip.rhtml.php.config b/ip.rhtml.php.config new file mode 100644 index 0000000..3397c2c --- /dev/null +++ b/ip.rhtml.php.config @@ -0,0 +1 @@ +title: Il tuo IP
\ No newline at end of file |