dsjklb0205 2015-10-27 13:44
浏览 141

使用Steam probs登录

<?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("settings.php");
        $openid = new LightOpenID($steamauth['']);

        $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());
            }

        return "<form action=\"?login\" method=\"post\"> <input type=\"image\" src=\"http://cdn.steamcommunity.com/public/images/signinthroughsteam/sits_".$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]; 

                    // First determine of the $steamauth['loginpage'] has been set, if yes then redirect there. If not redirect to where they came from
                    if($steamauth['loginpage'] !== "") {
                        $returnTo = $steamauth['loginpage'];
                    } else {
                        //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();
    }
    }

    ?>

"Not Found The requested URL /login was not found on this server." idk how i do that.. search here and here but nothing found :c i tried all time but i get the error with /login not found on the server "yes i know my english is maybe to bad :D"

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 高德地图点聚合中Marker的位置无法实时更新
    • ¥15 DIFY API Endpoint 问题。
    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办