I am using steam open id to allow users to login to my website. Here is what I have now. Just a not I got this from a tutorial and changed it to match my needs.
<?php
include "apikey.php";
include "OpenID.php";
$link = mysql_connect('', '', '', ' ');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
$OpenID = new LightOpenID("MyWebsite");
session_start();
if(!$OpenID->mode) {
if(isset($_GET['login'])) {
$OpenID->identity = "http://steamcommunity.com/openid";
header("Location: {$OpenID->authUrl()}");
}
if(!isset($_SESSION['T2SteamAuth'])){
$login = print ('<form action="?login" method="post">
<input type="image" src="http://cdn.steamcommunity.com/public/images/signinthroughsteam/sits_large_border.png"/>
</form>');
}
} elseif($OpenID->mode == "cancel") {
echo "canceled";
} else {
if(!isset($_SESSION['T2SteamAuth'])) {
$_SESSION['T2SteamAuth'] = $OpenID->validate() ? $OpenID->identity : null;
$_SESSION['T2SteamID64'] = str_replace("http://steamcommunity.com/openid/id", "", $_SESSION['T2SteamAuth']);
if($_SESSION['T2SteamAuth'] !== null) {
$Steam64 = str_replace("http://steamcommunity.com/openid/id", "", $_SESSION['T2SteamAuth']);
$profile = file_get_contents("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={$api}&steamids={$Steam64}");
$buffer = fopen("cache/{Steam64}.json". "w+");
fwrite($buffer, $profile);
fclose($buffer);
}
header("Location: login3.php");
}
}
if(isset($_SESSION['T2SteamAuth'])) {
$Steam64id = $_SESSION['T2SteamAuth'];
print($Steam64id);
$sql = "INSERT INTO ``.`` (`id`) VALUES ('$Steam64id')";
mysql_query($sql, $link);
mysql_close($link);
print('<form action = "?logout" method="post"><button title="logout" name="logout">Logout</button></form>');
}
if(isset($_GET['logout'])) {
unset($_SESSION['T2SteamAuth']);
unset($_SESSION['T2SteamID64']);
header("Location: login3.php");
}
?>
This code allows users to login to my site and their id is sent to my database. What I want to do is allow these users to use a forum. I downloaded a forum plugin and open id but for some reason my code does not allow users to use my forum and I don't know why. To get users to use my forum they have to go to wp-login.php and type in https://steamcommunity.com/openid/login and then login that way, separately from my code. I would like to have this code allow users to login to a forum. Any help would be great. Thanks