Så på loginknappen på sidan ska länkningen se ut t.ex:
<div class="col-md-12 text-center"><a href="https://steamcommunity.com" class="btn btn-primary btn-lg btn-block" style="margin-bottom: 10px;">Login to Steam</a></div>
Såhär ser min steamauth php fil ut
<?php
ob_start();
session_start();
require ('openid.php');
function logoutbutton() {
echo "<form action=\"steamauth/logout.php\" method=\"post\"><input value=\"Logout\" type=\"submit\" /></form>"; //logout button
}
function steamlogin()
{
try {
require("steamauth/settings.php");
$openid = new LightOpenID($steamauth['domain']);
$button['small'] = "small";
$button['large_no'] = "large_noborder";
$button['large'] = "large_border";
$button = $button[$steamauth['buttonstyle']];
if(!$openid->mode) {
if(isset($_GET['login'])) {
$openid->identity = 'http://steamcommunity.com/openid';
header('Location: ' . $openid->authUrl());
}
//echo "<form action=\"?login\" method=\"post\"> <input type=\"image\" src=\"http://cdn.steamcommunity.com/public/images/signinthroughstea...".$button.".png\"></form>";
}
elseif($openid->mode == 'cancel') {
echo 'User has canceled authentication!';
} else {
if($openid->validate()) {
$id = $openid->identity;
$ptn = "/^http:\/\/steamcommunity\.com\/openid\/id\/(7[0-9]{15,25}+)$/";
preg_match($ptn, $id, $matches);
$_SESSION['steamid'] = $matches[1];
include_once("set.php");
$query = mysql_query("SELECT * FROM users WHERE steamid='".$_SESSION['steamid']."'");
if (mysql_num_rows($query) == 0) {
mysql_query("INSERT INTO users (steamid) VALUES ('".$_SESSION['steamid']."')") or die("MySQL ERROR: ".mysql_error());
}
if (isset($steamauth['loginpage'])) {
header('Location: '.$steamauth['loginpage']);
}
} else {
echo "User is not logged in.\n";
}
}
} catch(ErrorException $e) {
echo $e->getMessage();
}
}
?>
Och såhär ser min "redirect" ut (adress länk och api key också men klippte bort de)
$steamauth['logoutpage'] = "index.php";
$steamauth['loginpage'] = "index.php";