Context-detection API for Android developed as a university project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?PHP
  2. session_start();
  3. define('OPENID_TRUSTROOT', 'http://chris.smith.name/android/');
  4. $allowedIDs = array(
  5. 'https://www.google.com/accounts/o8/id?id=AItOawlVzlhRypZuhvENeUFtVWY_flhmyihDje8', // Me
  6. 'https://www.google.com/accounts/o8/id?id=AItOawkmbwj0T1NMwv9GVrrY5g3VD5WsiVlWUhc', // Simon
  7. 'https://www.google.com/accounts/o8/id?id=AItOawkZ2rNlFp4lHowKWFYFiGRYLi51dlrhAzI', // Shane
  8. );
  9. if (isset($_SESSION['openid']['error'])) {
  10. // Failed OpenID login attempt
  11. echo 'ERROR: ', htmlentities($_SESSION['openid']['error']);
  12. unset($_SESSION['openid']['error']);
  13. exit;
  14. } else if (isset($_SESSION['openid']['validated']) && $_SESSION['openid']['validated']) {
  15. if (!in_array($_SESSION['openid']['identity'], $allowedIDs)) {
  16. echo 'ERROR: ', htmlentities($_SESSION['openid']['identity']), ' not permitted';
  17. unset($_SESSION['openid']);
  18. exit;
  19. }
  20. } else {
  21. if (!isset($_REQUEST['openid_mode'])) {
  22. $_POST['openid_url'] = 'https://www.google.com/accounts/o8/id';
  23. }
  24. require('openid/processor.php');
  25. exit;
  26. }
  27. ?>