Presto-X Posted October 15, 2012 Share Posted October 15, 2012 Hello guys, I'm trying to restrict free email providers domain's from our sign up form so they have to use their company's email address not their free spam email account. Below is the code I have written so far, it seems like it would work, and it seems to work most of the time, but from time to time one or two will slip in, how is that possible? $domains = array('gmail','msn','yahoo','hotmail','excite','lycos','aol','inbox','fastmail','mail','maricopa','care2','zenbe','gmx','gawab','goowy','hotpop','mybestmail','bigstring','live','comcast','cableone','qwest','earthlink','netzero','clearwire','mybluedish','wildblue','clear'); $emailDomain = explode('@',$_POST['email']); $emailDomain = explode('.',$emailDomain[1]); if(in_array($emailDomain[0],$domains)){ $error_msg = 'Sorry your email\'s domain is not allowed, please use your associated company email.'; }else{ // Add the user to the database. } Quote Link to comment Share on other sites More sharing options...
Jessica Posted October 15, 2012 Share Posted October 15, 2012 Yeah good luck with that Quote Link to comment Share on other sites More sharing options...
gizmola Posted October 16, 2012 Share Posted October 16, 2012 I'm kind of with Jess here. Why is it in your interest to try and force potential customers to use a particular email address? There are lots of reasons why someone might want to use web email, and I know plenty of small companies, contractors and people who use these sites. I've worked with people who use aol as an example. So you basically don't want their business because they didn't use "someco.com". Seems short sighted to me. With that said, your algorithm depends on explode, and exact matches. One obvious problem is that if I enter me@Gmail.com, i'm getting through your domain list. Ditto, if I put in a subdomain like me@y.something.com. I'd suggest at very least you do: $_POST['email'] = strtolower(trim($_POST['email'])); Quote Link to comment Share on other sites More sharing options...
Presto-X Posted October 16, 2012 Author Share Posted October 16, 2012 I completely agree with you guys, I think its a stupid idea, but my boss and all of his wisdom wants the users to use their real company email address. Gizmola, thanks I did not even think of that lol I will get it added. Quote Link to comment Share on other sites More sharing options...
kicken Posted October 16, 2012 Share Posted October 16, 2012 ... users to use their real company email address. You should try and convince him how dumb such a thing is. For some people those emails are their "real company email". I've seen numerous small-businesses that use whatever@comcast.net or whatever@gmail.com as their business email. Just a few weeks ago I was out and saw guy who runs a handyman/contracting business using hisname@comcast.net for his email. Had it painted on his truck right along side his business name, phone and fax numbers. Quote Link to comment Share on other sites More sharing options...
Jessica Posted October 16, 2012 Share Posted October 16, 2012 What is a "real company email"? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 16, 2012 Share Posted October 16, 2012 Your boss is a moron with no business sense. Quote Link to comment Share on other sites More sharing options...
Christian F. Posted October 16, 2012 Share Posted October 16, 2012 Even Dropbox uses gmail, though they have their own domain. In any case, I don't see any problems with allowing anyone to use any e-mail address they like. In the case of some undesired e-mail addresses being used, you'll only accurately find them using a manual check. Quote Link to comment Share on other sites More sharing options...
White_Lily Posted October 16, 2012 Share Posted October 16, 2012 by real business email, im guessing they mean "name@businessname.com" and why would you even want to restrict gmail? people have gmail accounts for their analytics and things, so companies probably finding it easier using that address rather than creating a whole brand new one. Quote Link to comment Share on other sites More sharing options...
kicken Posted October 16, 2012 Share Posted October 16, 2012 So sitting here at an autoshop waiting for my car I see a bunch of business cards for different business in the area, bot big and small. Remembering this thread I figured I would check the emails against the above. Results: 28 cards total 20 have a email on them 8 have an address that would be rejected by the above Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted October 16, 2012 Share Posted October 16, 2012 You should try and convince him how dumb such a thing is. For some people those emails are their "real company email". I've seen numerous small-businesses that use whatever@comcast.net or whatever@gmail.com as their business email. Just a few weeks ago I was out and saw guy who runs a handyman/contracting business using hisname@comcast.net for his email. Had it painted on his truck right along side his business name, phone and fax numbers. I use gmail for my business/professional email account as well. Not mentioned is how Sisyphean the task itself is. There are a gazillion free email services around the globe. Does your boss really think that it's possible to block all of them? I mean, you could always just compare whether or not the email address' domain matches the domain of the website the user entered (if they're required to enter their business' URL (if they have one... oy)), but then you're back at "This is a dumb idea" anyway. Can you show your boss this thread? Because he strikes me as one of those people who's more apt to listen to professional strangers on the internet than the people he hired expressly for their technical ability. Not kidding. There are plenty of middle management people who can only be persuaded that their idea is shit by a neutral and respected 3rd party. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.