Advertisement
Guest User

Untitled

a guest
Dec 17th, 2010
781
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. <?php
  2. require 'openid.php';
  3. try {
  4.     $openid = new LightOpenID;
  5.  
  6. $openid->required = array('contact/email');//
  7. $openid->optional = array('namePerson','namePerson/friendly','birthDate','person/gender');//
  8.  
  9.     if(!$openid->mode) {
  10.             $openid->identity = 'yahoo.com';
  11.             header('Location: ' . $openid->authUrl());
  12. ?>
  13. <form action="" method="post">
  14.     <button>Login with Yahoo!</button>
  15. </form>
  16. <?php
  17.     } elseif($openid->mode == 'cancel') {
  18.         echo 'User has canceled authentication!';
  19.     } else {
  20.         echo 'User ' . ($openid->validate() ? $openid->identity . ' has ' : 'has not ') . 'logged in.';
  21.         print_r( $openid->getAttributes());//
  22.     }
  23. } catch(ErrorException $e) {
  24.     echo $e->getMessage();
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement