Code standards, fix base path at least for php includes and use single quotes more often
[busui.git] / include / common-auth.inc.php
blob:a/include/common-auth.inc.php -> blob:b/include/common-auth.inc.php
<?php <?php
require $basePath.'lib/openid.php';  
  require ROOT . '/../lib/openid.php';
$openid = new LightOpenID($_SERVER['HTTP_HOST']); $openid = new LightOpenID($_SERVER['HTTP_HOST']);
   
function login() function login() {
{ global $openid;
global $openid; if (!$openid->mode) {
if(!$openid->mode) { $openid->required = array('contact/email');
$openid->required = array('contact/email'); $openid->identity = 'https://www.google.com/accounts/o8/id';
$openid->identity = 'https://www.google.com/accounts/o8/id'; header('Location: ' . $openid->authUrl());
header('Location: ' . $openid->authUrl()); }
} }
}  
  function auth() {
  if ($_SESSION['authed'] == true)
  return true;
  global $openid;
   
  if ($openid->mode) {
  $attr = $openid->getAttributes();
  if ($attr['contact/email'] != 'maxious@gmail.com') {
  die('Access Denied');
  } else {
  $_SESSION['authed'] = true;
  }
  } else {
  login();
  }
  }
   
   
function auth()  
   
{  
if ($_SESSION['authed'] == true) return true;  
global $openid;  
   
if($openid->mode) {  
$attr = $openid->getAttributes();  
if ($attr["contact/email"] != "maxious@gmail.com") {  
die("Access Denied");  
} else {  
$_SESSION['authed'] = true;  
}  
} else {  
login();  
}  
}