aboutsummaryrefslogtreecommitdiffstats
path: root/library/openid/example.php
diff options
context:
space:
mode:
authorzottel <github@zottel.net>2014-02-19 08:30:14 +0100
committerzottel <github@zottel.net>2014-02-19 08:30:14 +0100
commit79d3dae7fa80df6ea6914807bcde4d8b8c390361 (patch)
tree96327bd990038c66f0e644c505522cb424a1bbd0 /library/openid/example.php
parent2bca2199112625593eb412584e17e874e71ca913 (diff)
parent24d119b8c4e94ed130577e4e4a8d17ea13c406ac (diff)
downloadvolse-hubzilla-79d3dae7fa80df6ea6914807bcde4d8b8c390361.tar.gz
volse-hubzilla-79d3dae7fa80df6ea6914807bcde4d8b8c390361.tar.bz2
volse-hubzilla-79d3dae7fa80df6ea6914807bcde4d8b8c390361.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'library/openid/example.php')
-rw-r--r--library/openid/example.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/library/openid/example.php b/library/openid/example.php
new file mode 100644
index 000000000..e4ab107fe
--- /dev/null
+++ b/library/openid/example.php
@@ -0,0 +1,23 @@
+<?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();
+}