-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfinish.php
39 lines (30 loc) · 1.15 KB
/
finish.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
<?php
require_once("common.php");
function escape($thing) {
return htmlentities($thing);
}
$return_to = getReturnTo();
$response = $consumer->complete($return_to);
// Check the response status.
if ($response->status == Auth_OpenID_CANCEL) {
// This means the authentication was cancelled.
$msg = 'Verification cancelled.';
} else if ($response->status == Auth_OpenID_FAILURE) {
// Authentication failed; display the error message.
$msg = "OpenID authentication failed: " . $response->message;
} else if ($response->status == Auth_OpenID_SUCCESS) {
// This means the authentication succeeded; extract the
// identity URL and Simple Registration data (if it was
// returned).
$openid = $response->getDisplayIdentifier();
$esc_identity = escape($openid);
$msg = sprintf('You have successfully verified ' .
'<a href="%s">%s</a> as your identity.',
$esc_identity, $esc_identity);
$sreg = Auth_OpenID_SRegResponse::fromSuccessResponse($response)->contents();
$_SESSION['openid'] = $openid;
$_SESSION['username'] = @$sreg['username'];
$_SESSION['faction'] = @$sreg['faction'];
}
$_SESSION['msg'] = $msg;
header("Location: index.php");