Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 24, 2013, 02:34 PM   #1
CavemanUK
macrumors 6502
 
Join Date: Jun 2006
Location: Rhyl, North Wales
User Authentication question

Hi guys,

For a few years I've been playing around with a php driven website that manages the customers in our small business. Its very low usage and more of a fun project than anything... recently ive been looking at making it more mobile and more html5/css3 specific etc.

Anyway, I was thinking about the user authentication. Currently there are 3 users that are stored in a mysql database and validated in the obvious way.

I wanted to improve the security and stability of this side of things and was wondering if this is something i can use something like facebook or openid for? basically i want to allow the same 3 users access but nobody else. it seems like facebooks authentication would certainly ensure its the right person logging in.

does this make any kind of sense or is there a better way?
__________________
iMac 2.5/250 SSD/3GB Yosemite
iPhone 5S 16GB | iPad Mini Retina 16GB | iPad 2 16GB
CavemanUK is offline   0 Reply With Quote
Old Jan 26, 2013, 07:14 AM   #2
SrWebDeveloper
macrumors 68000
 
SrWebDeveloper's Avatar
 
Join Date: Dec 2007
Location: Alexandria, VA, USA
 
Quote:
Originally Posted by CavemanUK View Post
Hi guys,

I was wondering if this is something i can use something like facebook or openid for? basically i want to allow the same 3 users access but nobody else. it seems like facebooks authentication would certainly ensure its the right person logging in.
Yep.

Visit this page, download, install and load the class as instructed:

http://dan.cx/blog/2010/09/integrati...website-easily

This method is excellent because you can force Facebook authentication by including this in any PHP page, it's secure and uses the FB API, and the added bonus of optionally getting user's info after login to customize the PHP page.

Looking at the example code, to limit to 3 specific users try something like (untested, to show concept only after class is loaded which is not shown below, edit for your needs):

PHP Code:
$facebook = new FacebookLogin('100929283281389''8*******************************1');
$user $facebook->doLogin();
echo 
'User\'s URL: '$user->link'<br />';
echo 
'User\'s name: '$user->name'<br />';
echo 
'Full details:<br /><pre>'print_r($usertrue), '</ pre>';

// Set an array with 3 FB user names you permit
$allowedNames=array("joe","john","nancy");

// Authenticate them - remember in_array() is case sensitive
if (in_array($user->name,$allowedNames)) {

// Rest of page displays here - user is authorized so they can view it

} else {

// User is not permitted
echo "Sorry, $user->name, you are not permitted access to this page.";


__________________
Jim Goldbloom
Sr. Web Developer, owner GoldTechPro, LLC
http://www.GoldTechPro.com
SrWebDeveloper is offline   0 Reply With Quote

Reply
MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Question on limited user gman901 Mac Basics and Help 2 May 28, 2014 07:15 AM
New User Help! Battery question Warnie MacBook Air 13 Jul 9, 2013 05:48 AM
New iPhone User Question dnelms iPhone 6 Oct 2, 2012 08:38 AM
Lte question from Uk user. bandofbrothers iPhone 28 Sep 29, 2012 01:38 PM
User Picture Question squaremon OS X 10.8 Mountain Lion 5 Aug 1, 2012 11:30 AM

Forum Jump

All times are GMT -5. The time now is 09:06 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC