Solved

php login restrict domain registration

Posted on 2014-10-12
4
120 Views
Last Modified: 2014-10-17
Hi all,

I've been using this for a login for my clients.

http://www.php-login.net |  >>> Advanced version.

However I need to restrict the domain registration to only their company names...

I have the following however have no idea where to implement the code to...

		$access_list = array('example1.com', 'example2.com');

		$domain = substr(strrchr($user_email, "@"), 1); //extract domain name from email

		if (in_array($domain, $access_list)){ 
		echo "You are good to go";
		}else{ 
		echo "stop them from signing up";
		}

Open in new window

0
Comment
Question by:Geektank
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40375987
Whether that works or not, you are essentially taking their word for the domain.  Do you send an email to the email used for signup to complete the registration?  That would be something to verify that it is legitimate.
0
 

Author Comment

by:Geektank
ID: 40376040
it's OK I solved this Dave.
0
 

Accepted Solution

by:
Geektank earned 0 total points
ID: 40376044
if (strpos($_POST['user_email'],'example.com') !== false || strpos($_POST['user_email'],'example2.com') !== false) {

Open in new window

0
 

Author Closing Comment

by:Geektank
ID: 40386233
This worked
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question