Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Banning free email providers  (Read 25738 times)

0 Members and 1 Guest are viewing this topic.

Anne

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Banning free email providers
« on: April 11, 2005, 12:39:55 am »

Is there any way to prevent people from registering using a free email provider (ie. Hotmail, Yahoo, etc.)?
« Last Edit: April 11, 2005, 07:25:23 am by GauGau »
Logged

Nibbler

  • Guest
Re: Banning free email providers
« Reply #1 on: April 11, 2005, 12:55:24 am »

Yes. You need to edit your register.php

find:

Code: [Select]
if (!eregi("^[_\.0-9a-z\-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$", $email)) $error .= '<li>' . $lang_register_php['err_invalid_email'];
and add after it:

Code: [Select]
$banned = array(
'hotmail',
'yahoo',
'msn',
'gmail'
);

foreach($banned as $ban){
if (strpos(strtolower($email), "@$ban.")){
$error .= '<li>' . 'Registration not permitted from free email providers.';
break;
}
}

You can change the array of banned providers and the rejection message as required. You could also change the message to use $lang_register_php['err_invalid_email'] to give a general message of 'invalid email' in the user's language if you prefer.

This will not work for bridged installs.
Logged

brandoncolorado

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Banning free email providers
« Reply #2 on: April 14, 2005, 03:11:52 pm »

what about the opposite?  Is there any way I could only allow certain users (i.e. with email addresses from my school) to register?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Logged

brandoncolorado

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Banning free email providers
« Reply #4 on: April 14, 2005, 04:21:18 pm »

LOL *Blushes and never asks question again*
Logged

Leny

  • Translator
  • Coppermine novice
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 29
Re: Banning free email providers
« Reply #5 on: December 20, 2006, 08:54:20 pm »

Hi folks.
I have CPG 1.4.10 & BBH 2.0.21 bridged working fine.

Im looking for something that keep out certain domains (like 10minutemail.com or mailinator.com) from registering.

Reading this post and another one (Makc666's) I can't see solution for me but I think should be nice have an editable "blacklist", or something like that, in next releases of CPG (or some plugin).

Im just writing ideas, no solutions, i know.  :-\

Going back... anyone knows how can I ban domains having bridged system?  ??? Thanks.



Logged

Nibbler

  • Guest
Re: Banning free email providers
« Reply #6 on: December 20, 2006, 09:15:54 pm »

You need to do that in your forum.
Logged

Leny

  • Translator
  • Coppermine novice
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 29
Re: Banning free email providers
« Reply #7 on: December 20, 2006, 10:20:31 pm »

Thank you very much Nibbler!
Logged

wuurp

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Banning free email providers
« Reply #8 on: February 13, 2007, 06:50:59 pm »

What about blocking certain tlds, like .info or .biz?

Could this be made more general by doing for example:

Code: [Select]
$banned = array(
'@hotmail.',
'@yahoo.',
'@msn.',
'@gmail.',
'.info$',
'.biz$'
);

foreach($banned as $ban){
if (strpos(strtolower($email), "$ban")){
$error .= '<li>' . 'Registration not permitted from free email providers.';
break;
}
}

Logged

Nibbler

  • Guest
Re: Banning free email providers
« Reply #9 on: February 13, 2007, 06:57:07 pm »

Try

Code: [Select]
if (preg_match('/\.(info|biz)$/', $email)){
if (strpos(strtolower($email), "$ban")){
$error .= '<li>' . 'Registration not permitted from this tld.';
break;
}
}
Logged

wuurp

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Banning free email providers
« Reply #10 on: February 13, 2007, 08:15:02 pm »

oops.

Of course. My brain was still thinking about the eregi from the previous line, not strpos.

Thanks.
Logged

wuurp

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Banning free email providers
« Reply #11 on: February 26, 2007, 04:26:33 pm »

Try

Code: [Select]
if (preg_match('/\.(info|biz)$/', $email)){
if (strpos(strtolower($email), "$ban")){
$error .= '<li>' . 'Registration not permitted from this tld.';
break;
}
}

Should this actually be more like

Code: [Select]
if (preg_match('/\.(info|biz)$/', $email)) $error .= '<li>' . 'Registration not permitted from this tld.';
since it's no longer in that foreach loop?
Logged

Nibbler

  • Guest
Re: Banning free email providers
« Reply #12 on: February 26, 2007, 04:35:13 pm »

Yeah. I copied too much code.
Logged

Mimer

  • Translator
  • Coppermine frequent poster
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 129
    • Fjotte
Re: Banning free email providers
« Reply #13 on: December 18, 2011, 01:06:49 am »

Any chance I can use this code in CPG 1.5.16?
If so, where do I put it?

Code: [Select]
$banned = array(
'hotmail',
'yahoo',
'msn',
'gmail'
);

foreach($banned as $ban){
if (strpos(strtolower($email), "@$ban.")){
$error .= '<li>' . 'Registration not permitted from free email providers.';
break;
}
}
Logged
Pages: [1]   Go Up
 

Page created in 0.044 seconds with 20 queries.