From: Steve Sutton Date: Mon, 5 Dec 2016 20:57:52 +0000 (-0500) Subject: Double check for valid email address. X-Git-Tag: v1.0.0^2~8 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=bbbd6fc24481c5a1638ae133afa661d486ab057c;p=WP-Plugins%2Fglm-member-db-coupons.git Double check for valid email address. For admin email there maybe more than one. Explode the to emails and check each one. --- diff --git a/classes/helper/notification.php b/classes/helper/notification.php index 33bbf05..1ee49fd 100644 --- a/classes/helper/notification.php +++ b/classes/helper/notification.php @@ -93,6 +93,10 @@ class GlmMembersAdmin_coupon_notification extends GlmDataMembers if ( !$notify_to ) { return false; } + $validEmail = filter_var( $notify_to, FILTER_VALIDATE_EMAIL ); + if ( !$validEmail ) { + return false; + } $memberInfoData = new GlmDataMemberInfo( $this->wpdb, $this->config ); $memberInfo = $memberInfoData->getActiveInfoForMember( $memberId ); @@ -155,6 +159,14 @@ class GlmMembersAdmin_coupon_notification extends GlmDataMembers if ( !$notify_to ) { return false; } + // Double check the email for valid address + $emails = explode( ',', $notify_to ); + foreach ( $emails as $email ) { + $validEmail = filter_var( $email, FILTER_VALIDATE_EMAIL ); + if ( !$validEmail ) { + return false; + } + } // Setup the Smarty Engine $smarty = new smartyTemplateSupport();