Banning free email providers Banning free email providers
 

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

Banning free email providers

Started by Anne, April 11, 2005, 12:39:55 AM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

Anne

Is there any way to prevent people from registering using a free email provider (ie. Hotmail, Yahoo, etc.)?

Nibbler

Yes. You need to edit your register.php

find:

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:

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

brandoncolorado

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

Joachim Müller


brandoncolorado

LOL *Blushes and never asks question again*

Leny

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.




Nibbler


Leny


wuurp

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

Could this be made more general by doing for example:

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



Nibbler

Try


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

wuurp

oops.

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

Thanks.

wuurp

Quote from: Nibbler on February 13, 2007, 06:57:07 PM
Try


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

if (preg_match('/\.(info|biz)$/', $email)) $error .= '<li>' . 'Registration not permitted from this tld.';

since it's no longer in that foreach loop?

Nibbler


Mimer

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

Quote from: Nibbler on April 11, 2005, 12:55:24 AM
$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;
}
}