My favorites
▼
|
Sign in
lightopenid
Lightweight OpenID library.
Project Home
Downloads
Wiki
Issues
Source
Export to GitHub
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
10
attachment: example.php
(1.1 KB)
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
<?php
//require 'openid.php';
require 'OpenID.php';
try {
if(!isset($_GET['openid_mode'])) {
if(isset($_POST['openid_identifier'])) {
$openid = new LightOpenID;
//$openid = new Ncw_OpenID;
$openid->required = array('namePerson/friendly', 'contact/email');
$openid->optional = array('contact/email');
$openid->identity = $_POST['openid_identifier'];
header('Location: ' . $openid->authUrl());
}
?>
<form action="" method="post">
OpenID: <input type="text" name="openid_identifier" value="yandex.ru" /> <button>Submit</button>
</form>
<?php
} elseif($_GET['openid_mode'] == 'cancel') {
echo 'User has canceled authentication!';
} else {
$openid = new LightOpenID;
//$openid = new Ncw_OpenID;
$openid->required = array('namePerson/friendly', 'contact/email');
$openid->optional = array('contact/email');
echo 'User ' . ($openid->validate() ? $openid->identity . ' has ' : 'has not ') . 'logged in.';
var_dump($openid->getAttributes());
}
} catch(ErrorException $e) {
echo $e->getMessage();
}
Powered by
Google Project Hosting