Simplified PHP code again

This commit is contained in:
François-Xavier de Guillebon 2016-06-17 16:41:01 +02:00 committed by GitHub
parent 258cd41cbf
commit b933e1d96f

View File

@ -25,13 +25,9 @@ PHP contributed by @txt3rob
```php
function is_temp_mail($mail) {
$mail_domains_ko = file('disposable_email_blacklist.conf', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach($mail_domains_ko as $ko_mail) {
list($mail_address, $mail_domain) = explode('@',$mail);
if(strcasecmp($mail_domain, $ko_mail) == 0){
return true;
}
}
return false;
//Need to ensure the mail contains an @ to avoid undefined offset
return in_array(explode('@', $mail)[1], $mail_domains_ko);
}
```