1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

PHP: Restricting to certain email addresses

Discussion in 'Software Development' started by ChunkyTeXas, Nov 25, 2006.

Thread Status:
Not open for further replies.
  1. ChunkyTeXas

    ChunkyTeXas Thread Starter

    Joined:
    Dec 14, 2002
    Messages:
    84
    Hello,

    I am wanting to restrict my login system where only users with a certain @whatever.com email address can join. I am at a loss on how to do this. I heard somewhere to use pattern matching but im still a little unsure. Could anyone possibly help me out?
     
  2. brendandonhu

    brendandonhu

    Joined:
    Jul 8, 2002
    Messages:
    14,681
    PHP:
    <?php
    function checkEmail($email)
    {
      
    $allowed = array('hotmail.com''yahoo.com');
      list( , 
    $domain) = explode('@'$email);
      return 
    in_array($domain$allowed) ? true false;
    }
    ?>
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/521292

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice