开发者

ip2nation - don't understand how the ip value is stored

The ip2nation table stores ip values like such:

IP      COUNTRY
687865856   za
689963008   eg

How does this translate into an actual IP address b开发者_StackOverflow中文版lock range?


I believe, it uses INET_ATON() and INET_NTOA() mysql function

update: Yep. I've just checked.

SELECT INET_NTOA( 687865856 )
>> 41.0.0.0
SELECT INET_NTOA( 689963008 )
>> 41.32.0.0


Just look at the Sample Scripts:

SELECT 
    c.country 
FROM 
    ip2nationCountries c,
    ip2nation i 
WHERE 
    i.ip < INET_ATON("'.$_SERVER['REMOTE_ADDR'].'") 
    AND 
    c.code = i.country 
ORDER BY 
    i.ip DESC 
LIMIT 0,1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜