fastread homefastrread library fastread menu

PHP Tutorial : Login With Microsoft Live Account or Hotmail

Tutorial by:Admin      Date: 2016-04-14 02:05:26

❰ Previous Next ❱

Microsoft provide very easy steps to create login and registration system using Live open id. Microsoft has also lunched OAuth systems which helps developer to get user's information form Hotmail and Outlook. The following steps guide you to create a Login and registration system.

You need Client Secret Key and Client ID, Click Here to generate both the keys. 

Include your database connection file and set your client id, client secret and redirect URL in login-hotmail.php file.

$client_id = '******************'; $client_secret = '******************'; $redirect_uri = 'Online Path to/login-hotmail.php'; ?>

Now set URL for Microsoft Live/ Hotmail authentication and link login/ register button to the following URL.

$urls = ''.$client_id.'

The above URL will take you to hotmail login page. If you provide correct login info then this will redirect you to redirect URL set above. Where you will get user unique id, first name, last name and email id. Which you can save in varible.

$userid = $profile_res['id'];
$fname = $profile_res['first_name'];
$lname = $profile_res['last_name'];
$email = $profile_res['emails']['account'];

If you are using the system first time then it will ask you to register to the system or else it will take you to your dashboard page autometically.

$fname = mysql_real_escape_string($_POST['fname']);
$lname = mysql_real_escape_string($_POST['lname']);
$email = mysql_real_escape_string($_POST['email']);
$passcode = mysql_real_escape_string($_POST['passcode']);
$loginwith = mysql_real_escape_string($_POST['loginwith']);
$status = 'active';
$mysql = mysql_query("insert into register set fastname = '".$fname."',
lastname = '".$lname."',
email = '".$email."',
passcode = '".$passcode."',
loginwith = '".$loginwith."',
status = '".$status."'");

The MySql table used in this project

`userid` int(11) NOT NULL AUTO_INCREMENT,
`fastname` varchar(50) NOT NULL,
`lastname` varchar(50) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`passcode` varchar(100) NOT NULL,
`loginwith` varchar(20) NOT NULL,
`status` varchar(10) NOT NULL,
PRIMARY KEY (`userid`),
UNIQUE KEY `userid` (`userid`)


❰ Previous Next ❱

PHP Tutorial

Submit Your Thought, Tutorial, Articls etc.

Submit Your Information India's Number one online promotion website