From 1ed020ceda7eeaad277def8da05cb7c9963d1fb8 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Tue, 28 Jul 2015 11:17:33 -0600 Subject: [PATCH] The email_validate is a generic function so moving it to resources/functions.php. --- resources/functions.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/resources/functions.php b/resources/functions.php index 1388857fec..8c2466ba29 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -1314,4 +1314,18 @@ function number_pad($number,$n) { } } +//email validate + function email_validate($strEmail){ + $validRegExp = '/^[a-zA-Z0-9\._-]+@[a-zA-Z0-9\._-]+\.[a-zA-Z]{2,3}$/'; + // search email text for regular exp matches + preg_match($validRegExp, $strEmail, $matches, PREG_OFFSET_CAPTURE); + + if (count($matches) == 0) { + return 0; + } + else { + return 1; + } +} + ?> \ No newline at end of file