Kevin Waterson wrote:
This one time, at band camp, Stut <[EMAIL PROTECTED]> wrote:


Which brings me back to my earlier question of why would you want to do this? I can't think of any reason, but then again it is getting late.

I would like to prevent registration of emails from certain domains that
abuse a forum. eg: foo.uy7f564d8d6d.com
These domains are registered by the thousands by spammers and because they
use dyndns it is impossible to use an IP block.

Banning the subdomain is pointless as this is easily changed and they may
re-register.

In pseudo-PHP (i.e. untested)...

$banned = array('example.net', 'example.co.uk');
list(,$domain) = explode('@', $emailaddress, 2);
$banned = false;
foreach ($banned as $ban)
{
    if ($domain == $ban ||
        preg_match('|\.'.preg_quote($ban).'$|i', $domain))
    {
        $banned = true;
        break;
    }
}
if ($banned) die('Bad spammer. *slap*');

Far more efficient than trying to do what you asked for help with no matter how long your banned list gets.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to