<?php
$email = $_GET['email'];
if( filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
$domain = array_pop(explode('@', $email));
} else exit('Invalid email.');
$allowed_domains = ['gmail.com', 'outlook.com','yahoo.com','mail.com'];
//the more legitimate ones you add the better
if (in_array($domain,$allowed_domains))
{
print $email.' is allowed to register';
} else {
print $email.' is not allowed to register';
}
|