Bloking Specific Email Domains in register.php Bloking Specific Email Domains in register.php
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

Bloking Specific Email Domains in register.php

Started by pjohn323, July 01, 2010, 05:38:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pjohn323

Found this code for blocking email domains by adding an array (in an old post), but it's not working, what did I do wrong ?

function check_email ( $uemail ) {
  global $control, $error;
    if ( ! strlen ( $uemail ) ) {
        $error = translate ( 'Email address cannot be blank.' );
            return false;
    }
***********************************************************
        $banned = array(
          '21cn',
          'tom',
          'siteposter', );
foreach($banned as $ban){
   if (strpos(strtolower($uemail), "@$ban.")){
       $error .= '<li>' . 'Registration not permitted from these email providers.';
             return false;
       }
**********************************************************
       $res = dbi_execute ( 'SELECT cal_email FROM webcal_user WHERE cal_email = ?',
             array ( $uemail ) );
   if ( $res ) {    $row = dbi_fetch_row ( $res );
   if ( $row[0] == $uemail ) {
       $control = '';
       $error = translate ( 'Email address already exists.' );
             return false;
           }
       }
         return true;
   }


Added code between ....... ************ 's

onthepike

Please post a link to your gallery as per board rules.

As well, please post the link to the topic in which you make reference.

TeraS

As per the solution posted in the 1.5 plugins subforum:

Quote from: Αndré on June 22, 2010, 04:13:44 PM
In register.php, find
    if (!Inspekt::isEmail($email)) {
        $error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['email_warning2'] . '</li>';
    }

and after it add your preferred solution



Αndré

Is this topic solved? If not, try to replace your code with this one:
$banned = array(
  '21cn',
  'tom',
  'siteposter'
);
foreach($banned as $ban) {
    if (strpos(strtolower($uemail), "@$ban.")) {
        $error .= '<li>' . 'Registration not permitted from these email providers.';
        return false;
   }
}