Location: PHPKode > projects > Apache Stats > apacheStats_0.0.3Beta/includes/ipgather.inc
<?PHP
	function Dot2LongIP ($IPaddr){
		if ($IPaddr == ""){
			return 0;
		}
		else{
			$ips = split ("\.", "$IPaddr");
			return ($ips[3] + $ips[2] * 256 + $ips[1] * 256 * 256 + $ips[0] * 256 * 256 * 256);
		}
	}

	function getCountry ($addy){
		$ipno = Dot2LongIP($addy);
		$ipaddy = "SELECT country, high, low from countrycodes where low<=$ipno and high>=$ipno";
		$getCountry = mysql_query($ipaddy);
		while($myrow = mysql_fetch_array($getCountry)){
			$userCountry=$myrow[country];
		}
		return $userCountry;
	}
?>
Return current item: Apache Stats