| @@ 49-59 (lines=11) @@ | ||
| 46 | if('' == $ip) |
|
| 47 | //$ip = getenv('REMOTE_ADDR'); |
|
| 48 | $ip = GetClientIp(); |
|
| 49 | if (false == ip2long($ip)) |
|
| 50 | return ''; |
|
| 51 | else { |
|
| 52 | $part = explode('.', $ip); |
|
| 53 | if (4 != count($part)) |
|
| 54 | return ''; |
|
| 55 | else |
|
| 56 | for ($i=0; $i<=count($part)-1; $i++) { |
|
| 57 | $hex .= substr('0' . dechex($part[$i]), -2); |
|
| 58 | } |
|
| 59 | } |
|
| 60 | return $hex; |
|
| 61 | } // end of func ClientIpToHex |
|
| 62 | ||
| @@ 56-69 (lines=14) @@ | ||
| 53 | } |
|
| 54 | // @codeCoverageIgnoreEnd |
|
| 55 | ||
| 56 | if (false == ip2long($ip)) { |
|
| 57 | return ''; |
|
| 58 | } else { |
|
| 59 | $part = explode('.', $ip); |
|
| 60 | if (4 != count($part)) { |
|
| 61 | // @codeCoverageIgnoreStart |
|
| 62 | return ''; |
|
| 63 | // @codeCoverageIgnoreEnd |
|
| 64 | } else { |
|
| 65 | for ($i = 0; $i <= count($part)-1; $i ++) { |
|
| 66 | $hex .= substr('0' . dechex($part[$i]), -2); |
|
| 67 | } |
|
| 68 | } |
|
| 69 | } |
|
| 70 | return $hex; |
|
| 71 | } |
|
| 72 | } |
|