summaryrefslogtreecommitdiff
path: root/ip.rhtml.php
diff options
context:
space:
mode:
Diffstat (limited to 'ip.rhtml.php')
-rw-r--r--ip.rhtml.php22
1 files changed, 22 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