通过Steam无法正常工作(OpenID)

Alright, I am having a bit of a problem with signing in through steam on my website. The code seems to work up until you press the "Yes, sign in." here: Screenshot.

When I click the "Yes, sign in." button it redirects me back to the page that the sign in button was on and the sign in button is not not visible as if it worked but the scripted logout button is not there either. It is just a blank page and it has a really long 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

The log in button also comes back after a page refresh.

Here is the code, I am using the LightOpenID API.

<?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}\"/>";

}

?>
dqwnxdhb88531
dqwnxdhb88531 我不是在寻找一种替代方法,而是我正在寻找修复方法。
6 年多之前 回复
duanli0162
duanli0162 可能重复的SteamAPI身份验证
6 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐