芝麻web文件管理V1.00
编辑当前文件:/home/strato/chroot/opt/RZphp5/includes/Net/CheckIP.php
* * @author Martin Jansen
* @author Guido Haeger
* @package Net_CheckIP * @version 1.1 * @access public */ class Net_CheckIP { /** * Validate the syntax of the given IP adress * * This function splits the IP address in 4 pieces * (separated by ".") and checks for each piece * if it's an integer value between 0 and 255. * If all 4 parameters pass this test, the function * returns true. * * @param string $ip IP adress * @return bool true if syntax is valid, otherwise false */ function check_ip($ip) { $oct = explode('.', $ip); if (count($oct) != 4) { return false; } for ($i = 0; $i < 4; $i++) { if (!preg_match("/^[0-9]+$/", $oct[$i])) { return false; } if ($oct[$i] < 0 || $oct[$i] > 255) { return false; } } return true; } } ?>