Solved

php login restrict domain registration

Posted on 2014-10-12
4
119 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

Suggested Solutions

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
This video teaches users how to migrate an existing Wordpress website to a new domain.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

730 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