Changeset 156
Legend:
- Unmodified
- Added
- Removed
-
trunk/README
r155 r156 4 4 *General Intall* 5 5 6 The installation is as simple as these 4steps:6 The installation is as simple as these 5 steps: 7 7 8 8 1) Copy config-sample.php to config.php -
trunk/index.php
r155 r156 37 37 $Id$ 38 38 39 */39 */ 40 40 41 41 function ipInRange($range, $address) { 42 42 $range = str_replace(array(' ', "\r", "\n"), '', $range); 43 list($a, $b, $c, $d) = explode('.', $address); 44 $check = ($a << 24) + ($b << 16) + ($c << 8) + $d; 43 45 foreach(explode(',', $range) as $ip) { 44 46 list($base, $bits) = explode('/', $ip); … … 47 49 $i = ($a << 24) + ($b << 16) + ($c << 8) + $d; 48 50 $mask = $bits == 0 ? 0 : (~0 << (32 - $bits)); 49 50 51 $low = $i & $mask; 51 52 $high = $i | (~$mask & 0xFFFFFFFF); 52 53 53 list($a, $b, $c, $d) = explode('.', $address);54 $check = ($a << 24) + ($b << 16) + ($c << 8) + $d;55 54 if ($check >= $low && $check <= $high) { 56 55 return true;
