Advanced Search

Results 1 to 3 of 3

Thread: Restricting registration to specific email extensions

  1. #1
    Join Date
    Jan 2010
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Restricting registration to specific email extensions

    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!

  2. #2
    Join Date
    Jul 2010
    Location
    Minnesota
    Posts
    243
    Thanks
    1
    Thanked 18 Times in 18 Posts

    Default

    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.

  3. #3
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Since you asked in the php section I presume you want it in PHP.
    I suggest php explode and array count.
    Code:
    $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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •