This commit is contained in:
Kar
2025-01-30 17:03:27 +05:30
parent f7306b70c8
commit a176102cd9
53 changed files with 24 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
<?php
$ipv4 = $_SERVER['REMOTE_ADDR'];
// Get the IPv6 address of the client if available
$ipv6 = $_SERVER['REMOTE_ADDR'];
if (strpos($ipv6, ":") !== false) {
// IPv6 address detected
$ipv6 = explode("%", $ipv6)[0]; // Remove interface suffix, if any
} else {
// No IPv6 address detected
$ipv6 = "IPv6 not available";
}
// Display IPv4 and IPv6 addresses
echo "IPv4 Address: " . $ipv4 . "<br>";
echo "IPv6 Address: " . $ipv6 . "<br>";
?>