how the ip was stored in database?
phpipam open-source IP address management
Brought to you by:
myha
hi,
how the ip was stored in database?
I want to clone a virtual machine, and assign a free IP address automatically.
but when I look in the database given ip are not written clearly but via code numbers,
for example 3334445555.
can you explain to me how is the information stored? or how to translate it?
or better yet, how to list the free ip to a text file;-)
thks in advance
remi
Anonymous
Hi, there are 2 functions in php which converting IP to long and viceversa.
ip2long http://us2.php.net/manual/en/function.ip2long.php
long2ip http://us2.php.net/manual/en/function.long2ip.php
I think this would help you.
Hi, it is written in decimal. Mysql has native functions inet_aton and inet_ntoa to convert, but I believe ipv6 is not supported.
You can use ip2long/long2ip as Orkhan suggested in php, but they are also only for ipv4.
brm