I have a CVS database which gives a V6 range 2001:1800::/32 and a country code US. So far I have them in $ip_address $cc_code.
I need to store each range in MySQL. I also need take a user IP address and get the country code. I already got V4 working by storing a start and end range but the database already gave me that. So I’m stuck on getting V6 to work. I did some Google searches and can’t find much on this. Maybe I’m asking wrong? So can someone here give me some advice? I already know how to detect V4 and V6. So I have lots of it done so far. Just storing range/code and retiring it where i’m stuck.
IP addressed are basically Integers, you just need to convert them and the interact with basic math skills: WHERE $ip BETWEEN
startANDend. http://www.samclarke.com/2011/07/php-ipv6-to-128bit-int/