News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Unknown column 'pg.def_avatar' in 'field list' - topics broken

Started by azasmith, December 03, 2013, 12:31:27 PM

Previous topic - Next topic

azasmith

Hi Arantor,

I've tested using a "restricted" email address and it does give them an error to go back and enter a different one when they try to submit. I've pasted the entire section of code that the modification adds, just to make sure there's nothing obvious outside of the 535-545 range. But it only gives the error when a user successfully signs up. Confusing.  :laugh:

// Lets restrict some email providers
    if (!empty($modSettings['restricted_provider']))
    {
        $restricted_provider = explode(",", preg_replace("/(\@[^a-zA-Z0-9,])/", "", $modSettings['restricted_provider']));

        foreach ($restricted_provider as $key => $value)
            if (empty($value))
                unset($restricted_provider[$key]);
    }
    else
        $restricted_provider = array();



    if (!empty($modSettings['enable_restrict_EmailProvider']) && !empty($modSettings['restricted_provider']))
    {
        foreach($restricted_provider as $provider)
        {
            preg_match('/' . $provider . '+/i', $_POST['email'], $matches);

            if(count($matches) > 0)
                fatal_error(sprintf($txt['restricted'], $regOptions['username']), false);
        }
    }

    if (!empty($modSettings['accepted_provider']))
    {
        $accepted_provider = explode(",", preg_replace("/(\@[^a-zA-Z0-9,])/", "", $modSettings['accepted_provider']));

        foreach ($accepted_provider as $akey => $avalue)
            if (empty($avalue))
                unset($accepted_provider[$akey]);
    }
    else
        $accepted_provider = array();

    if (!empty($modSettings['enable_restrict_EmailProvider']) && !empty($modSettings['accepted_provider']))
    {
        foreach($accepted_provider as $aprovider)
        {
            preg_match('/' . $aprovider . '+/i', $_POST['email'], $matches);

            if(count($accepted_provider) == 1)
            {
                if(count($matches) == 0)
                    fatal_error(sprintf($txt['restricted'], $regOptions['username']), false);
            }
            else
            {
                if(count($matches) == 0 && !(each($accepted_provider)))
                    fatal_error(sprintf($txt['restricted'], $regOptions['username']), false);
            }
        }
    }

Arantor

Then that suggests you've used an invalid value for the restriction. What exactly did you put in?

azasmith

The list of restricted emails is far too long to post on here, but the value is @domainname.com,@otherdomainname.com etc etc. You can either use a whitelist or a blacklist, I'm using the blacklist, therefore the whitelist is left blank. (It tells you to do this on the settings page)

I'm not sure if me using error twice in the same sentence really made a lot of sense. The error when they input a 'restricted' email address is what is supposed to happen, it pulls the error from the language files. If a user successfully signs up, I get the preg match error in the Admin log.


Arantor

The code seems to suggest that it should work properly in that situation.

Advertisement: