array( 'user' => 'root', 'password' => '', ), ); /** * Simple function to show HTML page with given content. * * @param string $contents Content to include in page * * @return void */ function Show_page($contents) { header('Content-Type: text/html; charset=utf-8'); echo '' . "\n"; ?> phpMyAdmin OpenID signon example ' . $_SESSION['PMA_single_signon_message'] . '

'; unset($_SESSION['PMA_single_signon_message']); } echo $contents; ?> OpenID:
'; Show_page($content); exit; } /* Grab identifier */ if (isset($_POST['identifier'])) { $identifier = $_POST['identifier']; } else if (isset($_SESSION['identifier'])) { $identifier = $_SESSION['identifier']; } else { $identifier = null; } /* Create OpenID object */ try { $o = new OpenID_RelyingParty($returnTo, $realm, $identifier); } catch (OpenID_Exception $e) { $contents = "
\n"; $contents .= "
" . $e->getMessage() . "
\n"; $contents .= "
"; Show_page($contents); exit; } /* Redirect to OpenID provider */ if (isset($_POST['start'])) { try { $authRequest = $o->prepare(); } catch (OpenID_Exception $e) { $contents = "
\n"; $contents .= "
" . $e->getMessage() . "
\n"; $contents .= "
"; Show_page($contents); exit; } $url = $authRequest->getAuthorizeURL(); header("Location: $url"); exit; } else { /* Grab query string */ if (!count($_POST)) { list(, $queryString) = explode('?', $_SERVER['REQUEST_URI']); } else { // I hate php sometimes $queryString = file_get_contents('php://input'); } /* Check reply */ $message = new OpenID_Message($queryString, OpenID_Message::FORMAT_HTTP); $id = $message->get('openid.claimed_id'); if (!empty($id) && isset($AUTH_MAP[$id])) { $_SESSION['PMA_single_signon_user'] = $AUTH_MAP[$id]['user']; $_SESSION['PMA_single_signon_password'] = $AUTH_MAP[$id]['password']; session_write_close(); /* Redirect to phpMyAdmin (should use absolute URL here!) */ header('Location: ../index.php'); } else { Show_page('

User not allowed!

'); exit; } }