function check_mail($email, $simple = false) { global $config; if (preg_match("~^" . EMAIL_REGEXP . "\$~i", $email)) { list(, $domain) = explode('@', $email); $domain = strtolower($domain); // Check MX record. // The idea for this is from UseBB/phpBB if ($config['local_mode'] == 0 && $config['email_check_mx'] == 1 && !$simple) { if (checkmx_idna($domain) === false) { return false; } } if ($config['sessionmails'] == 1 && !$simple) { // get the known domains in lower case $sessionmails = file('data/sessionmails.php'); $sessionmails = array_map("trim", $sessionmails); $sessionmails = array_map("strtolower", $sessionmails); // compare the data and return the result if (in_array($domain, $sessionmails)) { return false; } } return true; } else { return false; } }
function check_mail($email, $simple = false) { global $config; if (preg_match("/^([_a-zA-Zהצ�0-9-]+(\\.[_a-zA-Z0-9הצu-]+)*@[a-zA-Zהצu0-9-]+(\\.[a-zA-Z0-9הצ�-]+)*(\\.[a-zA-Z]{2,}))/si", $email)) { list(, $domain) = explode('@', $email); $domain = strtolower($domain); // Check MX record. // The idea for this is from UseBB/phpBB if ($config['email_check_mx'] && !$simple) { if (checkmx_idna($domain) === false) { return false; } } if ($config['sessionmails'] == 1 && !$simple) { // get the known domains in lower case $sessionmails = file('data/sessionmails.php'); $sessionmails = array_map("trim", $sessionmails); $sessionmails = array_map("strtolower", $sessionmails); // compare the data and return the result if (in_array($domain, $sessionmails)) { return false; } } return true; } else { return false; } }