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!
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!
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.
Since you asked in the php section I presume you want it in PHP.
I suggest php explode and array count.
http://php.net/manual/en/function.explode.phpCode:$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.count.php
Bookmarks