bug?

Development discussion about the hostip.info codebase, libraries, and database

Moderator: Moderators

bug?

Postby cassy on Wed Dec 05, 2007 5:17 pm

Hi,
I have download "rsync" version.
but when I
Code: Select all
SELECT MIN( ip )
FROM `ip4`
WHERE `country` =73

=>26778880

in php:
Code: Select all
echo long2ip("26778880");
// display 1.152.157.0


on CLI:
Code: Select all
whois 1.152.157.0

OrgName: Internet Assigned Numbers Authority
OrgID: IANA
Address: 4676 Admiralty Way, Suite 330
City: Marina del Rey
StateProv: CA
PostalCode: 90292-6695
Country: US


so in sql is 73 (FR -> France) and whois command it's US... :?
cassy
n00b
 
Posts: 2
Joined: Tue Dec 04, 2007 4:48 pm

Postby cassy on Sun Dec 09, 2007 2:58 pm

Where do you find the association ip/country ?
because
Code: Select all
SELECT *
FROM `ip4`
ORDER BY `ip4`.`ip` DESC


4294967040 -> 255.255.255.0
4294953728 -> 255.255.203.0
4294901760 -> 255.255.0.0
4211157504 -> 251.1.42.0
4118661632 -> 245.125.202.0
4067238400 -> 242.109.34.0
4028718080 -> 240.33.92.0
3884713472 -> 231.140.6.0
3761027072 -> 224.44.184.0
3758096384 -> 224.0.0.0
3742866432 -> 223.23.156.0
3741318912 -> 222.255.255.0

only the last give a result with whois command.
:?
cassy
n00b
 
Posts: 2
Joined: Tue Dec 04, 2007 4:48 pm

Re: bug?

Postby bbugmenot on Fri Oct 24, 2008 9:11 am

use mysql's inet_aton(). PHP can handle only 31-bit positive integers and ip2long won't be compatible with unsigned int in mysql (unless you work around it with sprintf('%u',ip2long()))
bbugmenot
n00b
 
Posts: 6
Joined: Wed Nov 28, 2007 6:05 am


Return to Hostip.info code/database devel

Who is online

Users browsing this forum: No registered users and 3 guests

cron