/****************************************************************************************************************/ /* Description: This snippet is provide simple way to help user display Visitor's Sunrise and Sunset Time. */ /* suggestions for different city locations across the country. */ /* There are 1 steps in this snippet. For information, please visit IP2Location tutorial page at: */ /*https://www.ip2location.com/tutorials/display-sunrise-sunset-time-using-php-and-mysql-database */ /****************************************************************************************************************/ /* You can obtain free IP2Location LITE database for IPv6 at https://lite.ip2location.com/ */ '; echo 'Sunset Time: ' . $sunset . '
'; echo 'Sunrise Time: ' . $sunrise . '
'; echo 'Latitude: ' . $latitude . '
'; echo 'Longitude: ' . $longitude . '
'; echo $time_zone; // Function to convert IP address to IP number (IPv6) function Dot2LongIPv6 ($IPaddr) { $int = inet_pton($IPaddr); $bits = 15; $ipv6long = 0; while($bits >= 0){ $bin = sprintf("%08b", (ord($int[$bits]))); if($ipv6long){ $ipv6long = $bin . $ipv6long; } else{ $ipv6long = $bin; } $bits--; } $ipv6long = gmp_strval(gmp_init($ipv6long, 2), 10); return $ipv6long; } ?>