This commit is contained in:
Suvodip
2024-10-21 16:23:40 +05:30
parent 083494bd4d
commit f7306b70c8
7 changed files with 312 additions and 80 deletions

View File

@@ -1,19 +1,17 @@
<?php
// Get the IPv4 address of the client
// echo $_SERVER['REMOTE_ADDR'];
$ipv4 = $_SERVER['REMOTE_ADDR'];
$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";
}
// 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>";
// Display IPv4 and IPv6 addresses
echo "IPv4 Address: " . $ipv4 . "<br>";
echo "IPv6 Address: " . $ipv6 . "<br>";
?>