Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Bloking Specific Email Domains in register.php  (Read 2560 times)

0 Members and 1 Guest are viewing this topic.

pjohn323

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Bloking Specific Email Domains in register.php
« 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
Logged

onthepike

  • Guest
Re: Bloking Specific Email Domains in register.php
« Reply #1 on: July 01, 2010, 06:23:19 pm »

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.
Logged

TeraS

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 17
  • Lost but trying really hard...
    • Succubus.net
Re: Bloking Specific Email Domains in register.php
« Reply #2 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

Logged

pjohn323

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Bloking Specific Email Domains in register.php
« Reply #3 on: July 04, 2010, 12:50:56 am »

Thanks TeraS
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15761
Re: Bloking Specific Email Domains in register.php
« Reply #4 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;
   }
}
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 21 queries.