I'm using LightOpenID, and whilst it's very light, it's not very easy to understand, and it doesn't have a wiki...
The example file they do give is below (sorry for the elongated post), what I don't understand is why does it instantiate the LightOpenID twice?
require 'openid.php';
try {
if(!isset($_GET['openid_mode'])) { // what is this about?
if(isset($_POST['openid_identifier'])) {
$openid = new LightOpenID;
$openid->identity = $_POST['openid_identifier'];
header('Location: ' . $openid->authUrl());
}
?>
<form action="" method="post">
OpenID: <input type="text" name="openid_identifier" /> <button>Submit</button>
</form>
<?php
} elseif($_GET['openid_mode'] == 'cancel') {
echo 'User has canceled authentication!';
} else {
$openid = new LightOpenID;
echo 'User ' . ($openid->validate() ? $openid->identity . ' has ' : 'has not ') . 'logged in.';
}
} catch(ErrorException $e) {
echo $e->getMessage();
}
I'm trying to add it to my existing script here if someone is really feeling helpful. How can I make it so that when $openid->validate() returns true, I can save the $sql_answer to the database?