First we find the four bytes of the address then, by shifting them to the left, we add to obtain the decimal IP address: <? $bytes = explode(".", $_SERVER["REMOTE_ADDR"]); $decimal = ($bytes[0] << 24) + ($bytes[1] << 16) + ($bytes[2] << 8) + $bytes[3]; ?> PHP:
Damn, I just realised there's a built-in function for that ip2long: int ip2long ( string ip_address ) Code (markup):