= 0) { $bin = sprintf("%08b",(ord($ip_n[$bits]))); $ipbin = $bin.$ipbin; $bits--; } return $ipbin; } function bin2ip($bin) { if(strlen($bin) <= 32) // 32bits (ipv4) return long2ip(base_convert($bin,2,10)); if(strlen($bin) != 128) return false; $pad = 128 - strlen($bin); for ($i = 1; $i <= $pad; $i++) { $bin = "0".$bin; } $bits = 0; while ($bits <= 7) { $bin_part = substr($bin,($bits*16),16); $ipv6 .= dechex(bindec($bin_part)).":"; $bits++; } return inet_ntop(inet_pton(substr($ipv6,0,-1))); } echo "-- Hosts information --\n\n"; echo "IP: ".$_GET['query']."\n"; echo "Host: ".gethostbyaddr($_GET['query'])."\n"; echo "Long: ".sprintf("%u", ip2long($_GET['query']))."\n"; echo "Long Alt: ".sprintf("%u", ip2long(long2ip(ip2long($_GET['query']))))."\n"; echo "IP Bin: ".ip2bin($_GET['query'])."\n"; if($CompressPage=="none") { echo ob_get_clean(); } if($CompressPage=="gzip") { echo gzencode(ob_get_clean()); } if($CompressPage=="deflate") { echo gzcompress(ob_get_clean()); } ?>