本文整理汇总了PHP中LightOpenID::__get方法的典型用法代码示例。如果您正苦于以下问题:PHP LightOpenID::__get方法的具体用法?PHP LightOpenID::__get怎么用?PHP LightOpenID::__get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LightOpenID
的用法示例。
在下文中一共展示了LightOpenID::__get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strtr
session_start();
session_destroy();
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
session_start();
include "openid.php";
function base64url_decode($base64url)
{
$base64 = strtr($base64url, '-_', '+/');
$plainText = base64_decode($base64);
return $plainText;
}
$openid = new LightOpenID('mds.go-ao.eu');
if ($openid->mode) {
// echo $openid->validate() ? 'Logged in.' : 'Failed';
echo $openid->__get("identity");
$attributes = $openid->getAttributes();
$encodedPhoto = $attributes['eid/photo'];
$photo = base64url_decode($encodedPhoto);
$_SESSION['foto'] = $photo;
$_SESSION['naam'] = $attributes['namePerson'];
$_SESSION['gebdat'] = $attributes['birthDate'];
$_SESSION['straat'] = $attributes['contact/postalAddress/home'];
$_SESSION['postc'] = $attributes['contact/postalCode/home'];
$_SESSION['woonpl'] = $attributes['contact/city/home'];
$_SESSION['geslacht'] = $attributes['person/gender'];
$_SESSION['kaartnr'] = $attributes['eid/card-number'];
$_SESSION['nat'] = $attributes['eid/nationality'];
$_SESSION['pob'] = $attributes['eid/pob'];
$_SESSION['logged_in'] = true;
header('Location: beveiligd.php');
示例2: LightOpenID
}
return "";
}
try {
if (!isset($_GET['openid_mode'])) {
if (isset($_GET['login'])) {
$openid = new LightOpenID();
switch ($_GET["provider"]) {
case "steam":
$openid->identity = 'https://steamcommunity.com/openid/';
break;
default:
// google
$openid->identity = 'https://www.google.com/accounts/o8/id';
$openid->required = array('contact/email');
}
header('Location: ' . $openid->authUrl());
}
} elseif ($_GET['openid_mode'] == 'cancel') {
session_destroy();
echo 'User has canceled authentication!';
} else {
$openid = new LightOpenID();
if ($openid->validate() && $openid->identity) {
$userinfo = $openid->getAttributes();
$_SESSION['user_login'] = isset($userinfo['contact/email']) ? $userinfo['contact/email'] : $openid->__get("identity");
}
}
} catch (ErrorException $e) {
echo $e->getMessage();
}