diff options
Diffstat (limited to 'library/openid/example.php')
-rw-r--r-- | library/openid/example.php | 23 |
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(); +} |