1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hubzilla_ynh.git synced 2024-09-03 19:26:21 +02:00
hubzilla_ynh/sources/library/openid/example.php
2015-08-23 16:38:18 -04:00

23 lines
728 B
PHP

<?php
require 'openid.php';
try {
# Change 'localhost' to your domain name.
$openid = new LightOpenID('localhost');
if(!$openid->mode) {
if(isset($_POST['openid_identifier'])) {
$openid->identity = $_POST['openid_identifier'];
header('Location: ' . $openid->authUrl());
}
?>
<form action="" method="post">
OpenID: <input type="text" name="openid_identifier" /> <button>Submit</button>
</form>
<?php
} elseif($openid->mode == 'cancel') {
echo 'User has canceled authentication!';
} else {
echo 'User ' . ($openid->validate() ? $openid->identity . ' has ' : 'has not ') . 'logged in.';
}
} catch(ErrorException $e) {
echo $e->getMessage();
}