-6

i want only my corporate people to sign up , who've got E.G abc@ourcompany.com emails and not other people like abc@gmail.com or abc@outlook.co etc.

i'm not able to post my code here . i've posted it here , pls check and help http://pastebin.com/0aJZfHWx

  • hope they are not signing up to anything important, checking who they are based on email is not great approach. –  Oct 19 '14 at 19:22

1 Answers1

2
$allowed_domains = array("ourcompany.com");
$email_domain = array_pop(explode("@", $email));
if(!in_array($email_domain, $allowed_domains)) {
    // Not an authorised email 
}

It's simply. Make an array for allowed domains, explode by @, get the last element of the array and check if it exists in the allowed domains array.

Ali
  • 3,479
  • 4
  • 16
  • 31