OpenID Identity LoginFor Example: steve.myopenid.com'; return $output; } function OpenID_Standarize($openid_identity){ $u = parse_url(strtolower(trim($openid_identity))); if ($u['path'] == '/'){ $u['path'] = ''; } if(substr($u['path'],-1,1) == '/'){ $u['path'] = substr($u['path'], 0, strlen($u['path'])-1); } if (isset($u['query'])){ // If there is a query string, then use identity as is return $u['host'] . $u['path'] . '?' . $u['query']; }else{ return $u['host'] . $u['path']; } } if (!empty($_GET['openid_identity'])){ $_POST['authid'] = OpenID_Standarize($_GET['openid_identity']); } if( !empty($_POST['openid_url']) ){ // if (!empty($_POST['openid_url'])) return false; global $ScriptUrl, $PageUrl; require_once "authuseropenid.class.php"; $openid_url = $_POST['openid_url']; $OpenIDApprovedURL = 'http://' . $_SERVER["HTTP_HOST"]; if (strpos($_SERVER["REQUEST_URI"],'?') > 0){ $OpenIDApprovedURL .= substr($_SERVER["REQUEST_URI"],0,strpos($_SERVER["REQUEST_URI"],'?')); $OpenIDApprovedURL .= "?action=edit"; }else{ $OpenIDApprovedURL .= $_SERVER["REQUEST_URI"]; } $openid = new SimpleOpenID; $openid->SetIdentity($openid_url); $openid->SetTrustRoot('http://' . $_SERVER["HTTP_HOST"] . $ScriptUrl); // $openid->SetRequiredFields(array('email')); // $openid->SetOptionalFields(array('fullname')); if ($openid->GetOpenIDServer()){ $openid->SetApprovedURL($OpenIDApprovedURL); // Send Response from OpenID server to this script // echo $openid->GetIdentity(); // exit; $openid->Redirect(); // This will redirect user to OpenID Server }else{ // $error = $openid->GetError(); // print_r($error); // echo "ERROR CODE: " . $error['code'] . "
"; // echo "ERROR DESCRIPTION: " . $error['description'] . "
"; } } function AuthUserOpenId($pagename, $id, $pw, $pwlist) { if($_GET['openid_mode'] == 'id_res'){ require_once "authuseropenid.class.php"; $openid = new SimpleOpenID; $openid->SetIdentity($_GET['openid_identity']); $openid_validation_result = $openid->ValidateWithServer(); if ($openid_validation_result == true){ // OK HERE KEY IS VALID // echo 'true'; return true; }else{ // echo 'false'; return false; } }else{ return false; } } ?>