Re: ip2long and ipv6

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 9, 2012, at 4:44 AM, Arno Kuhl wrote:

> My dev and test tools are windows based and the apps deployed on linux, and
> it's been working well. But moving to win7 created problems because it uses
> ipv6 and code for ratings is for ipv4. Specifically, using ip2long to save
> the ip as an int (to prevent duplicate votes) doesn't work in test
> (win7/php5.3). I've got a quick-n-dirty workaround ("::1" converted to "0")
> but it seemed a good opportunity to add code to handle ipv6 properly when
> it's deployed.
> 
> I found a reference to do that in the help
> (http://php.net/manual/en/function.ip2long.php), but the referenced site no
> longer exists. I also found a page where Daniel Brown mentions that user
> notes referencing external sites are normally removed
> (http://www.lmpx.com/nav/article.php/news.php.net/php.notes/177158/read/inde
> x.html) but that the note added enough value to make an exception. I'd be
> very grateful if anyone could please point me to any other record of this
> code, or could post it if they have a copy.
> 
> Also, I'm assuming the code returns 2 ints because of the size of ipv6, and
> it's fine to change my code to store that, but I'd like to know if there's a
> standard way to store ip addresses in sql for quick lookup?
> 
> Cheers
> Arno

Arno

I use

http://us.php.net/manual/en/function.inet-pton.php
and
http://us.php.net/manual/en/function.inet-ntop.php

Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux