SetIdentity($_POST['openid_url']); $openid->SetTrustRoot('http://' . $_SERVER["HTTP_HOST"]); $openid->SetRequiredFields(array('email','fullname')); $openid->SetOptionalFields(array('dob','gender','postcode','country','language','timezone')); if ($openid->GetOpenIDServer()){ $openid->SetApprovedURL('http://' . $_SERVER["HTTP_HOST"] . $_SERVER["PATH_INFO"]); // Send Response from OpenID server to this script $openid->Redirect(); // This will redirect user to OpenID Server }else{ $error = $openid->GetError(); echo "ERROR CODE: " . $error['code'] . "
"; echo "ERROR DESCRIPTION: " . $error['description'] . "
"; } exit; } else if($_GET['openid_mode'] == 'id_res'){ // Perform HTTP Request to OpenID server to validate key $openid = new SimpleOpenID; $openid->SetIdentity($_GET['openid_identity']); $openid_validation_result = $openid->ValidateWithServer(); if ($openid_validation_result == true){ // OK HERE KEY IS VALID echo "VALID"; }else if($openid->IsError() == true){ // ON THE WAY, WE GOT SOME ERROR $error = $openid->GetError(); echo "ERROR CODE: " . $error['code'] . "
"; echo "ERROR DESCRIPTION: " . $error['description'] . "
"; }else{ // Signature Verification Failed echo "INVALID AUTHORIZATION"; } }else if ($_GET['openid_mode'] == 'cancel'){ // User Canceled your Request echo "USER CANCELED REQUEST"; } ?> OpenID Example
OpenID Login
" method="post" onsubmit="this.login.disabled=true;">
Get an OpenID
Sponsored by: FiveStores - get your free online store; includes extensive API for developers; integrated with OpenID