1

Topic: Banning TLD's, like .ru?

I have a small traffic forum and don't want to switch to adding captcha support until v1.3 comes out, but when I try to use PunBB to block the .ru email address it says "incomplete domain" or something similar. Is there a way to ban whole TLDs, as every bogus registration I have (low volume) puts the russkies domain in as their email.

Re: Banning TLD's, like .ru?

You can't ban a whole TLD by default. To do so, you would need to edit the is_banned_email function in include/email.php at least (and admin_bans.php if you don't want to insert/edit bans involving entire TLDs via the command line)

Re: Banning TLD's, like .ru?

Smartys wrote:

You can't ban a whole TLD by default. To do so, you would need to edit the is_banned_email function in include/email.php at least (and admin_bans.php if you don't want to insert/edit bans involving entire TLDs via the command line)

you can ban entire tld's in phpBB with ease. just input *@*.tld where tld = {ru, biz, etc...) and it wont allow those emails to be used for registration.

i dont see why this cant be an easy mod for 1.2.x series and not considered for the 1.3.x project.

~thegleek

Re: Banning TLD's, like .ru?

thegleek: Why do you always seem to be so combative? tongue
Nobody is stopping anyone from creating a mod, nobody has said that it isn't a possibility for 1.3, and PunBB is not phpBB (and it wasn't a feature in phpBB for a while as well)

Re: Banning TLD's, like .ru?

Smartys wrote:

thegleek: Why do you always seem to be so combative? tongue

sorry. bad online persona? i dunno. i just took you the wrong way when you said it couldnt be done. and i was just saying it could be done.

Smartys wrote:

Nobody is stopping anyone from creating a mod, nobody has said that it isn't a possibility for 1.3, and PunBB is not phpBB (and it wasn't a feature in phpBB for a while as well)

smile

~thegleek

Re: Banning TLD's, like .ru?

I said it couldn't be done by default and then pointed out what needed to be edited to have it done wink

7

Re: Banning TLD's, like .ru?

Thanks for the info Smartys, it is a low volume board and banning a TLD would really only work for situations like mine, and not well even then smile

Re: Banning TLD's, like .ru?

Hi

Were do i put this *@*.ru ?

Regards


John

Re: Banning TLD's, like .ru?

You can't by default: as I said, you need to modify at least one file first

Re: Banning TLD's, like .ru?

I've got no problem issuing CLI commands, nor do I have any problem with editing include/email.php, but... *what* commands can I use to ban all of .ru? Or... *where* in the ban function would I add the tld? Here's the function:

//
// Check if $email is banned
//
function is_banned_email($email)
{
    global $db, $pun_bans;

    foreach ($pun_bans as $cur_ban)
    {
        if ($cur_ban['email'] != '' &&
            ($email == $cur_ban['email'] ||
            (strpos($cur_ban['email'], '@') === false && stristr($email, '@'.$cur_ban['email']))))
            return true;
    }

    return false;
}

I don't see any obvious place in there where I could a .tld. In another thread, it's suggested to use the Ban admin section and enter a partial, but it accepts neither *.ru nor .ru .

So... can anyone clarify the process a bit? Thanks.

11

Re: Banning TLD's, like .ru?

you have to add a test on the email that check if it finishes by .ru and returns true if it does.

Re: Banning TLD's, like .ru?

Yemgi, umm... I know. I was asking for a code sample so I wouldn't blow the parentheses or something. But it turned out to be pretty easy:

    foreach ($pun_bans as $cur_ban)
    {
        if ($cur_ban['email'] != '' &&
            ($email == $cur_ban['email'] ||
            strstr('.ru',$email) ||
            (strpos($cur_ban['email'], '@') === false && stristr($email, '@'.$cur_ban['email']))))
            return true;
    }

I'll give it 24 hours to see if it works, that looks pretty solid.

Re: Banning TLD's, like .ru?

Hmmm.... nope, that didn't work - still seeing .ru emails going out. Can anyone see what's wrong with the code change above?

Re: Banning TLD's, like .ru?

That's because you have the parameter order for strstr mixed up wink
But here's a better way:
replace

strstr('.ru',$email)

with

substr($email, -3) === '.ru'

Re: Banning TLD's, like .ru?

Dang - that didn't  work  either. Tweaked it this morning, but  just got another .ru signup attempt now. Grrr... thanks though.

Re: Banning TLD's, like .ru?

Because after reading the code, I can see that's not where you want to put it wink

FIND

//
// Check if $email is banned
//
function is_banned_email($email)
{
    global $db, $pun_bans;

    foreach ($pun_bans as $cur_ban)
    {
        if ($cur_ban['email'] != '' &&
            ($email == $cur_ban['email'] ||
            (strpos($cur_ban['email'], '@') === false && stristr($email, '@'.$cur_ban['email']))))
            return true;
    }

    return false;
}

REPLACE WITH

//
// Check if $email is banned
//
function is_banned_email($email)
{
    global $db, $pun_bans;

    if (substr($email, -3) === '.ru')
        return true;

    foreach ($pun_bans as $cur_ban)
    {
        if ($cur_ban['email'] != '' &&
            ($email == $cur_ban['email'] ||
            (strpos($cur_ban['email'], '@') === false && stristr($email, '@'.$cur_ban['email']))))
            return true;
    }

    return false;
}

Re: Banning TLD's, like .ru?

D'oh! Thanks Smartys. Let's see how that does  over the next  24 hours.

Any chance this functionality will  be in a future release (or  plugin?)

Re: Banning TLD's, like .ru?

A plugin would be impossible wink
There's potential for an extension for 1.3 though

Re: Banning TLD's, like .ru?

Hrm, no dice - just received another bounce from a .ru address a minute ago. The code looks solid, but something's not quite right.

Am I the only one receiving dozens of bogus .ru signups per day? How is everyone else handling this problem?

20

Re: Banning TLD's, like .ru?

No.  I get a fair amount of bogus signups on my site.  Some are .ru and some are mail.ru and other various things.

I would really like to know of a way to simply block certain domains from registering at all.  Anyone know of a good way to completely block registrations from all of the obvious spammer registrations?  It's very easy to tell when a spammer registers just by the email...

Re: Banning TLD's, like .ru?

what TLDs do u think are "safe"?

.com, .net, .org

thats what I plan to use for now, I cant think of any others. Although its wont be long til they just change their code to adjust

Re: Banning TLD's, like .ru?

I personally would never ban a whole TLD tongue
hotmail.com, yahoo.com, etc are all used by spammers as well

23

Re: Banning TLD's, like .ru?

Smartys wrote:

I personally would never ban a whole TLD tongue
hotmail.com, yahoo.com, etc are all used by spammers as well

The ability to ban TLDs would reduce the amount of spam my forum gets by at least 90%. Banning .ru and .info alone would halve the spam problem on my own board. It would also mean I wouldn't have to spend 2 hours per week deleting/banning spam sign-ups.

My community was small (around 30 active members) but it has effectively died now because of the spam, it's a shame.

24 (edited by LVZ 2007-06-21 14:52)

Re: Banning TLD's, like .ru?

I edited the include/email.php

this works for me:

// Validate an e-mail address
//
function is_valid_email($email)
{
    if (strlen($email) > 50)
        return false;

// Allow primarily American TLDs only
$TLD3 = substr($email, -3);
if( $TLD3 != 'com' && $TLD3 != 'net' && $TLD3 != 'org' && $TLD3 != 'edu' && $TLD3 != 'gov'
                           && $TLD3 != '.ca' )
    return false;

// this also blocks lower tier USA TLDs .info .biz .us .name
 

    return preg_match('/^(([^<>()[\]\\.,;:\s@"\']+(\.[^<>()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email);
}

.:.

25 (edited by mindlessoath 2007-06-21 13:43)

Re: Banning TLD's, like .ru?

i too get alot of .ru signups. its annoying!
i also get alot of email from russian spammers, wtf?

anyways, it would be great if someone could make a plugin or modification for more effective (hrmm, mabe i mean more options for...) ban control and also a check on declining .ru addresses from signing up! i would like it to ban the address that signed up with .ru too!

someone make that please! its really need for this spam problem! the other modifications work, but only so much.