Php 通过Steam登录不工作(OpenID)

Php 通过Steam登录不工作(OpenID),php,openid,lightopenid,steam-web-api,Php,Openid,Lightopenid,Steam Web Api,好的,我在通过steam登录我的网站时遇到了一些问题。在您按“是,登录”之前,代码似乎一直在运行。此处: 当我点击“Yes,sign in.”按钮时,它会将我重定向回登录按钮所在的页面,并且登录按钮不可见,就好像它工作了一样,但是脚本化的注销按钮也不在那里。它只是一个空白页面,有一个很长的URL: http://localhost/Websites/Unknown%20Infernos/?page=login&login&openid.ns=http%3A%2F%2Fspecs.

好的,我在通过steam登录我的网站时遇到了一些问题。在您按“是,登录”之前,代码似乎一直在运行。此处:

当我点击“Yes,sign in.”按钮时,它会将我重定向回登录按钮所在的页面,并且登录按钮不可见,就好像它工作了一样,但是脚本化的注销按钮也不在那里。它只是一个空白页面,有一个很长的URL:

http://localhost/Websites/Unknown%20Infernos/?page=login&login&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=id_res&openid.op_endpoint=https%3A%2F%2Fsteamcommunity.com%2Fopenid%2Flogin&openid.claimed_id=http%3A%2F%2Fsteamcommunity.com%2Fopenid%2Fid%2F76561198059756738&openid.identity=http%3A%2F%2Fsteamcommunity.com%2Fopenid%2Fid%2F76561198059756738&openid.return_to=http%3A%2F%2Flocalhost%2FWebsites%2FUnknown%2520Infernos%2F%3Fpage%3Dlogin%26login&openid.response_nonce=2014-01-24T10%3A00%3A27Ze43wSImRFeCb5vc9qw8uwlv8y9c%3D&openid.assoc_handle=1234567890&openid.signed=signed%2Cop_endpoint%2Cclaimed_id%2Cidentity%2Creturn_to%2Cresponse_nonce%2Cassoc_handle&openid.sig=SYWQBh%2BxowKdUqWvVhK6nl7Vskk%3D
页面刷新后,“登录”按钮也会返回

下面是代码,我使用的是LightOpenIDAPI

<?php
session_start();

include "openid.php";

$key = "XXXXXXXXXXXXXXXXXXXXXXXXX";
$OpenID = new LightOpenID("localhost");

if (!$OpenID->mode) {

    if (isset($_GET['login'])) {
        $OpenID->identity = "http://steamcommunity.com/openid";
        header("Location: {$OpenID->authUrl()}");
    }

    if (!isset($_SESSION['T2SteamAuth'])) {
        $login = "<div id=\"login\">Welcome Guest. Please <a href=\"?login\"><img src=\"http://cdn.steamcommunity.com/public/images/signinthroughsteam/sits_small.png\"/></a> to access this website.</div>";
    } elseif ($OpenID->mode == "cancel") {
        echo "user has cancelled Authentication.";
    } 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={$key}&steamids={$Steam64}");
                $buffer = fopen("cache/{$Steam64}.json", "w+");
                fwrite($buffer, $profile);
                fclose($buffer);

            }

            header("Location: ./index.php")

        }

    }

    if (isset($_SESSION['T2SteamAuth'])) {

        $login = "<div id=\"login\">Welcome Guest. Please <a href=\"?logout\">Logout</a> to access this website.</div>";

    }

    if (isset($_GET['logout'])) {

        unset($_SESSION['T2SteamAuth']);
        unset($_SESSION['T2SteamID64']);
        header("Location: ./index.php");

    }

    $steam = json_decode(file_get_contents("cache/{$_SESSION['T2SteamID64']}.json"));

    echo $login;

    //echo "<img src\"{$steam->responce->players[0]->avatarfull}\"/>";

}

?>

可能的重复我没有从我现在正在做的事情中寻找替代方法,我正在寻找修复方法。