forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: pjohn323 on July 01, 2010, 05:38:46 pm

Title: Bloking Specific Email Domains in register.php
Post by: pjohn323 on July 01, 2010, 05:38:46 pm
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 ?

Code: [Select]
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
Title: Re: Bloking Specific Email Domains in register.php
Post by: onthepike on July 01, 2010, 06:23:19 pm
Please post a link to your gallery as per board rules (http://forum.coppermine-gallery.net/index.php/topic,55415.msg270616.html#msg270616).

As well, please post the link to the topic in which you make reference.
Title: Re: Bloking Specific Email Domains in register.php
Post by: TeraS on July 01, 2010, 09:33:48 pm
As per the solution posted in the 1.5 plugins subforum:

In register.php, find
Code: [Select]
    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

Title: Re: Bloking Specific Email Domains in register.php
Post by: pjohn323 on July 04, 2010, 12:50:56 am
Thanks TeraS
Title: Re: Bloking Specific Email Domains in register.php
Post by: Αndré on July 05, 2010, 02:29:27 pm
Is this topic solved? If not, try to replace your code with this one:
Code: [Select]
$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;
   }
}