Allow only emails from one domain?

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
Cross_+_Flame
Registered User
Posts: 295
Joined: Wed Oct 30, 2002 3:37 pm
Location: Okie-homa!
Contact:

Allow only emails from one domain?

Post by Cross_+_Flame » Mon Apr 26, 2004 9:27 pm

Hi, I'm wanting to begin a phpbb forum for my university, so everyone uses the same @blablah.edu extension. I know there is a way to ban certain email domains, but is there a way to restrict the list to ONLY those from one domain?

Basically, I only want to have my users be from the uni, and since we all have the same email domain, I thought this would be the easiest way to do it.

Thanks in advance!!

:edit: Abbuddull provided me with the following info:

The "limit registrations to one domain" is this code:

Code: Select all

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/functions_validate.php

#
#-----[ FIND ]------------------------------------------
#
	if (preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*?[a-z]+$/is', $email))

#
#-----[ REPLACE WITH ]------------------------------------------
#
if (preg_match('/^[a-z0-9&\'\.\-_\+]+@abc.com$/is', $email))
Of course you need to change 'abc.com' to reflect the domain you want to restrict registration to.

Cross_+_Flame
Registered User
Posts: 295
Joined: Wed Oct 30, 2002 3:37 pm
Location: Okie-homa!
Contact:

Post by Cross_+_Flame » Tue Jul 05, 2005 9:25 pm

Hello all, it has been a year, and I now have a new question. It should be easy for those experienced with php, but I can't figure it out.

The above code works for those with an @abc.com email address

Code: Select all

if (preg_match('/^[a-z0-9&\'\.\-_\+]+@abc.com$/is', $email))
However, I now need it to include alumni, who have an @alum.abc.com. That means I need variables to restrict it to both abc.com and alum.abc.com.

How do I go about letting both @abc.com and @alum.abc.com accounts work?

geocator
Registered User
Posts: 16242
Joined: Fri Jan 09, 2004 11:56 pm
Location: On dry land
Contact:

Post by geocator » Tue Jul 05, 2005 9:31 pm

Code: Select all

if (preg_match('/^[a-z0-9&\'\.\-_\+]+@abc.com$/is', $email) || preg_match('/^[a-z0-9&\'\.\-_\+]+@alum.abc.com$/is', $email))

Cross_+_Flame
Registered User
Posts: 295
Joined: Wed Oct 30, 2002 3:37 pm
Location: Okie-homa!
Contact:

Post by Cross_+_Flame » Tue Jul 05, 2005 10:12 pm

Ah excellent. Thank you! :D

Locked

Return to “2.0.x Support Forum”