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

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

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;
   }
}