social media

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.

<?php
$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 = 'https://login.live.com/oauth20_authorize.srf?client_id='.$client_id.'
&scope=wl.signin%20wl.basic%20wl.emails%20wl.contacts_emails
&response_type=code&redirect_uri='.$redirect_uri;

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.

if($_POST['register']){
$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."'");
header('Location:myaccount.php');
}

The MySql table used in this project
CREATE TABLE IF NOT EXISTS `register` (
`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`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
 

Other Login/ Registration Systems

Login/ Register With Facebook
Login/ Register With Twitter
Login/ Register With Linked In
Login/ Register With Yahoo!
Login/ Register With Gmail
Login/ Register With Email
Download File

Total Downloads: 2268
Top