PHP & Others

E-Mail 체크, IP 체크

페이지 정보

본문

<?
        function is_email($email)
        {
                return preg_match("/^(.+)\\@(.+)\\.(.+)$/", $email);
        }

        function is_ip($ip)
        {
                if(preg_match("/^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/", $ip, $match))
                        if($match[1] < 256 && $match[2] < 256 && $match[3] < 256 && $match[4] < 256)
                                return true;

                return false;
        }
?>

출처.. zend.com

관련자료

등록된 댓글이 없습니다.
Today's proverb
사랑의 계산 방법은 독특하다. 절반과 합쳐 하나가 되는 것이 아니라, 오직 두 개가 모여 완전한 하나를 만들기 때문이다. (조 코데르트)