doudi7570 2016-01-09 03:34
浏览 53

用steam登录返回白页?

On my website I have a login with steam feature, upon signing in on the steam end of this process, people are redirected to a white page, rather than the home page, also, the sign in data is never sent to the server, I've tried reading through my code but I can't seem to find why this problem is occurring.

openid.php

http://pasted.co/7824d0f0

settings.php

    <?php
$fileLoc = $_SERVER['DOCUMENT_ROOT'] . '/../passwords.txt';
if (file_exists($fileLoc)) {
    $fh = fopen($fileLoc, 'r');
    $jsonStr = fgets($fh);
    $arr = json_decode($jsonStr, true);
    $apiKey = $arr['steamAPIKey'];
    fclose($fh);
} else {
    die('no file found');
}

$steamauth['apikey'] = $7456B63D1E2C9CAFC06ACF35D97E1D9C; // Your Steam WebAPI-Key found at http://steamcommunity.com/dev/apikey
$steamauth['domainname'] = "http://www.csgoexcite.com/"; // The main URL of your website displayed in the login page
$steamauth['buttonstyle'] = "large"; // Style of the login button [small|large_no|large]
$steamauth['logoutpage'] = "index.php"; // Page to redirect to after a successfull logout (from the directory the SteamAuth-folder is located in) - NO slash at the beginning!
$steamauth['loginpage'] = "index.php"; // Page to redirect to after a successfull login (from the directory the SteamAuth-folder is located in) - NO slash at the beginning!

// System stuff
if (empty($steamauth['apikey'])) {die("<div style='display: block; width: 100%; background-color: red; text-align: center;'>SteamAuth:<br>Please supply an API-Key!</div>");}
if (empty($steamauth['domainname'])) {$steamauth['domainname'] = "localhost";}
if ($steamauth['buttonstyle'] != "small" and $steamauth['buttonstyle'] != "large") {$steamauth['buttonstyle'] = "large_no";}
?>

steam-login-handle.php

<?php
# Copyright (c) 2015 Jordan Turley, CSGO Win Big. All Rights Reserved.

session_start();
require('SteamAuthentication/steamauth/openid.php');

try {
    require('SteamAuthentication/steamauth/settings.php');
    $openid = new LightOpenID($steamauth['domainname']);


    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];

        header('Location: /index.html');

        //Determine the return to page. We substract "login&"" to remove the login var from the URL.
        //"file.php?login&foo=bar" would become "file.php?foo=bar"
        # $returnTo = str_replace('login&', '', $_GET['openid_return_to']);
        //If it didn't change anything, it means that there's no additionals vars, so remove the login var so that we don't get redirected to Steam over and over.
        # if($returnTo === $_GET['openid_return_to']) $returnTo = str_replace('?login', '', $_GET['openid_return_to']);
        # header('Location: '.$returnTo);
    } else {
        echo "User is not logged in.
";
    }
} catch(ErrorException $e) {
    echo $e->getMessage();
}
?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 软件自定义无线电该怎样使用
    • ¥15 R语言mediation包做中介分析,直接效应和间接效应都很小,为什么?
    • ¥15 Jenkins+k8s部署slave节点offline
    • ¥15 如何实现从tello无人机上获取实时传输的视频流,然后将获取的视频通过yolov5进行检测
    • ¥15 WPF使用Canvas绘制矢量图问题
    • ¥15 用三极管设计一个单管共射放大电路
    • ¥15 孟德尔随机化r语言运行问题
    • ¥15 pyinstaller编译的时候出现No module named 'imp'
    • ¥15 nirs_kit中打码怎么看(打码文件是csv格式)
    • ¥15 怎么把多于硬盘空间放到根目录下