IP4 optimized and IP6

Skip to first unread message


Jun 8, 2011, 8:59:59 PM6/8/11
to SlimStat
Hi from spain, sorry for my english, i saw that in the data base of
slim stat save the ip as varchar 15... this is very wrong for 2
1. is a varchar, size is more than int.
2. IPv6??

So, i maked a little snippet that you can costomize. For ip4 its easy,
ip2long, for ip6 first need convert to binary, later need convert to
integer the half of binary string, because this part in int its a int
that you can store in a bigint column.... for this reason you need 2
colums for IP (BIGINT), if the second is null, the ip is ip4

The script have comments, but in spanish, you can translate.


See you!! ;)
Reply all
Reply to author
0 new messages