@@ 24-33 (lines=10) @@ | ||
21 | * @return string |
|
22 | * @link http://us.php.net/uniqid |
|
23 | */ |
|
24 | function ClientIpFromHex($hex) { |
|
25 | $ip = ""; |
|
26 | if (8 == strlen($hex)) { |
|
27 | $ip .= hexdec(substr($hex ,0 ,2)) . '.'; |
|
28 | $ip .= hexdec(substr($hex ,2 ,2)) . '.'; |
|
29 | $ip .= hexdec(substr($hex ,4 ,2)) . '.'; |
|
30 | $ip .= hexdec(substr($hex ,6 ,2)); |
|
31 | } |
|
32 | return $ip; |
|
33 | } // end of func ClientIpFromHex |
|
34 | ||
35 | ||
36 | /** |
@@ 25-35 (lines=11) @@ | ||
22 | * @param string $hex |
|
23 | * @return string |
|
24 | */ |
|
25 | public function fromHex($hex) |
|
26 | { |
|
27 | $ip = ''; |
|
28 | if (8 == strlen($hex)) { |
|
29 | $ip .= hexdec(substr($hex, 0, 2)) . '.'; |
|
30 | $ip .= hexdec(substr($hex, 2, 2)) . '.'; |
|
31 | $ip .= hexdec(substr($hex, 4, 2)) . '.'; |
|
32 | $ip .= hexdec(substr($hex, 6, 2)); |
|
33 | } |
|
34 | return $ip; |
|
35 | } |
|
36 | ||
37 | ||
38 | /** |