View Full Version : Restricting registration to specific email extensions
danielmeade
01-23-2011, 12:29 PM
Hi, I'm after a script that will allow me to restrict user registration to certain email extensions. i.e .edu
Any help on this is much appreciated!
fastsol1
01-23-2011, 02:03 PM
Usually a regular expression is used to validate that the email is of the proper format and you could restrict the extension inside the expression also. I am just learning regular expressions so I can't give you a code example that would work but I know it's probably one of the better ways to do it.
Moglizorz
01-28-2011, 07:54 PM
Since you asked in the php section I presume you want it in PHP.
I suggest php explode and array count.
$split = explode($email,".")
if($split[count($split-1)]=="edu") {
# acceptable email, put code here for that
} else {
# unacceptable email, put code here for error returns
}
http://php.net/manual/en/function.explode.php
http://php.net/manual/en/function.count.php
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.