Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Now Available => Topic started by: Ride on August 27, 2004, 09:18:34 PM

Title: Do not allow certain email domains w/o having to use ban
Post by: Ride on August 27, 2004, 09:18:34 PM
It be nice to have an area in admin to not allow certain email domains w/o having to use the ban area. 
Title: Re: Do not allow certain email domains w/o having to use ban
Post by: dschwab9 on August 28, 2004, 01:03:53 AM
I agree.  A way to block hotmail/aol/etc without telling them "Sorry you are banned" and setting a cookie which locks them out forever.
Title: Re: Do not allow certain email domains w/o having to use ban
Post by: [Unknown] on August 28, 2004, 02:30:37 AM
I suppose the "and not setting a cookie which locks them out forever" part does make it seem a little more neccessary...

-[Unknown]
Title: Re: Do not allow certain email domains w/o having to use ban
Post by: Elijah Bliss on August 28, 2004, 04:51:59 AM
Quote from: dschwab9 on August 28, 2004, 01:03:53 AM
...and setting a cookie which locks them out forever.

This sounds excellent. I have this AOL troll that won't go away, the regular banning methods don't really work. Maybe making a cookie to redirect them to another site when they try to access your forum or something to that effect.
Title: Re: Do not allow certain email domains w/o having to use ban
Post by: dschwab9 on August 28, 2004, 07:01:38 AM
Quote from: [Unknown] on August 28, 2004, 02:30:37 AM
I suppose the "and not setting a cookie which locks them out forever" part does make it seem a little more neccessary...

-[Unknown]

Yeah.  If you're trying to keep out people with webmail accounts or something, you want to be able to politely tell them "That email domain is not allowed"  and allow them to enter a different one  :-\
Title: Re: Do not allow certain email domains w/o having to use ban
Post by: [Unknown] on August 28, 2004, 04:37:09 PM
Sources/Register.php, find:

if (empty($_POST['email']) || preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]+@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', stripslashes($_POST['email'])) == 0)
fatal_error(sprintf($txt[500], $_POST['user']), false);


Add below:
if (preg_match('~@(hotmail\.com|aol\.com|yahoo\.com|gmail\.com|engineer\.com|mail\.com|otherwebmailsite\.org)$~', $_POST['email']))
fatal_error('Sorry, but you cannot register here with a webmail/free email account.  Please choose a different email address, and remember that you can choose to keep your email hidden.', false);


This doesn't fix it everywhere, but it's better than nothing, no? (I'd put this in and then KEEP the ban... see?)

-[Unknown]
Title: Re: Do not allow certain email domains w/o having to use ban
Post by: Ride on August 29, 2004, 02:32:42 PM
It'd be nice to have an interface in the admin to do this.  Who's up for making a mod?   ;)
Title: Re: Do not allow certain email domains w/o having to use ban
Post by: Ride on September 20, 2004, 11:17:57 PM
Can somebody come up with a way to have the script check a text file for email domains that aren't allowed?  This would be easier than going into the code each time I needed to add a domain.  Thanks!!