Website login is very important part of web development, now era is change no buddy want fill registration form to login in website, so solve this problem technology has a solution, that is open social login with Google, yahoo, Facebook, twitter.
Step1: download auth file from below path
https://nodeload.github.com/brice/LightOpenId/zipball/master
Step2: To create login page to get action (index.php).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php session_start();
require 'openid.php';
try {
$openid = new LightOpenID('localhost');
$openid->required = array(
'namePerson',
'namePerson/first',
'namePerson/last',
'contact/email',
);
if(!$openid->mode) {
if(@$_GET['auth']=="google")
{
$_SESSION['auth']="Google";
$openid->identity = 'https://www.google.com/accounts/o8/id';
header('Location: ' . $openid->authUrl());
}elseif(@$_GET['auth']=="yahoo")
{
$_SESSION['auth']="Yahoo";
$openid->identity ='yahoo.com';
header("Location:".$openid->authUrl());
}
} elseif($openid->mode == 'cancel') {
echo 'User has canceled authentication!';
} else {
$external_login=$openid->getAttributes();
$_SESSION['name']=$external_login['namePerson/first']." ".$external_login['namePerson/last'];
$_SESSION['email']=$external_login['contact/email'];
header("Location:home.php");
exit();
}
} catch(ErrorException $e) {
echo $e->getMessage();
}
?>
<h1 class="center">Phpflow.com login</h1>
<table width="200" border="0" align="center" cellpadding="5" cellspacing="0" style="border:1px solid #CCC;">
<tr>
<td><form id="form1" name="form1" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td>E-mail address</td>
<td><label>
<input type="text" name="user" id="user" />
</label></td>
</tr>
<tr>
<td>Password</td>
<td><label>
<input type="text" name="pass" id="pass" />
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="button" id="button" value="Submit" />
</label></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td bgcolor="#F6F6F6">
<a href="index.php?auth=google"> <img src="http://my.syyn.cc/images/Google-login-button.png" alt="google Login" border="0" /></a>
<a href="index.php?auth=yahoo"> <img src="http://l.yimg.com/a/i/reg/openid/buttons/17.png" alt="yahoo Login" border="0" /></a>
</td>
</tr>
</table>
Result

Step3: To create home page to redirect after successful login. (home.php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php session_start();
if(!isset($_SESSION['auth']))
{
header("Location:index.php");
exit();
}
?>
<span><a href="sign-out.php">Sign Out</a></span>
<div>Account Home : After Successfull Login</div>
You are Sign In with : <strong><?=$_SESSION['auth'] ?></strong> Account, User ID: <strong><?=$_SESSION['email'] ?></strong></td>
Result

Step4: To create signout page to redirect after successful logout (signout.php).
1
2
3
4
5
6
7
8
9
<?php session_start();
session_destroy();
header("Location:index.php");
exit();
?>