Re: Re: get domain component from email

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kevin Waterson wrote:
This one time, at band camp, Stut <stuttle@xxxxxxxxx> 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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux