Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Steam probs登录 <?php ob_start(); session_start(); require ('openid.php'); function logoutbutton() { _Php_Html_Https_Steam - Fatal编程技术网

使用Steam probs登录 <?php ob_start(); session_start(); require ('openid.php'); function logoutbutton() {

使用Steam probs登录 <?php ob_start(); session_start(); require ('openid.php'); function logoutbutton() { ,php,html,https,steam,Php,Html,Https,Steam,使用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\" /></f

使用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.\n";
            }

        }
    } catch(ErrorException $e) {
        echo $e->getMessage();
    }
    }

    ?>