X-Git-Url: http://git.pk910.de/?p=PHP-P10.git;a=blobdiff_plain;f=Uplink%2FIPAddr.class.php;h=266e4b6a23d944f3ea67929e8ed7e0770a03033b;hp=fbc7c9839c3c7d3c833aa7dd0b0e4ba8fcb4a861;hb=811bc0c7a1f583fb624a0f8c3601146e063c5a25;hpb=fd791f788d0bed66cfdd0e671dc04f6d064d88dc diff --git a/Uplink/IPAddr.class.php b/Uplink/IPAddr.class.php index fbc7c98..266e4b6 100644 --- a/Uplink/IPAddr.class.php +++ b/Uplink/IPAddr.class.php @@ -1,22 +1,19 @@ . * * * ************************************************************************ * @@ -34,7 +31,7 @@ class IPAddr { public function __construct($initial_value) { for($i = 0; $i < 8; $i++) { - $ip6[$i] = 0; + $this->ip6[$i] = 0; } if($initial_value == null) { //nothing @@ -60,12 +57,14 @@ class IPAddr { $rightBlocks = (strlen($numeric) - $i - 1) / 3; $skipBlocks = 8 - $j - $rightBlocks; $j += $skipBlocks; + $i++; } else { $value = Numerics::numToInt($numeric[$i].$numeric[$i+1].$numeric[$i+2]); $this->ip6[$j++] = dechex($value); $i += 3; } } + $this->addr_is_ipv6 = true; } } @@ -82,6 +81,7 @@ class IPAddr { $this->ip6[$j++] = hexdec($block); } } + $this->addr_is_ipv6 = true; } public function parseIPv4($ipv4) { @@ -90,6 +90,7 @@ class IPAddr { $this->ip6[6] |= intval($ipv4blocks[1]); $this->ip6[7] = intval($ipv4blocks[2]) << 8; $this->ip6[7] |= intval($ipv4blocks[3]); + $this->addr_is_ipv6 = false; } public function isIPv6() {