MySQL脚本检索Steam ID,没有别的

I have a problem with the Steam Authentication for the web. As you know, Steam provides a script to allow people to connect on your site through the Steam database. My problem is my code only inserts the Steam ID in the database and not the name & avatar. My code:

if (isset($_GET['login'])){
require 'db.php';
require 'openid.php';
require 'userInfo.php';
try {
    require 'SteamConfig.php';

    $openid = new LightOpenID($steamauth['domainname']);

    if(!$openid->mode) {
        $openid->identity = 'http://steamcommunity.com/openid';
        header('Location: ' . $openid->authUrl());
    } 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];

                $sql_fetch_id = "SELECT * FROM member WHERE steamid = '".$_SESSION['steamid']."'";
                $query_id = mysqli_query($db, $sql_fetch_id);

                if (mysqli_num_rows($query_id) == 0) {
                    $sql_steam = "INSERT INTO member (name, steamid, avatar) VALUES  ('".$_SESSION['personaname']."', '".$_SESSION['steamid']."', '".$_SESSION['avatar']."')";
                    mysqli_query($db, $sql_steam);
                }

            if (!headers_sent()) {
                header('Location: '.$steamauth['loginpage']);
                exit;
            } else {
                ?>
                <script type="text/javascript">
                    window.location.href="<?=$steamauth['loginpage']?>";
                </script>
                <noscript>
                    <meta http-   equiv="refresh" content="0;url=<?=$steamauth['loginpage']?>" />
                </noscript>
                <?php
                exit;
            }

            } else {
            echo "User is not logged in.
";
        }
    }
} catch(ErrorException $e) {
    echo $e->getMessage();
}
 }

Screenshot screenshot

Looking at the output of var_dump($_SESSION) (which should be in the question) it seems as if you're not actually referencing the keys of the session correctly.

With this line of code:

$sql_steam = "INSERT INTO member (name, steamid, avatar) VALUES  ('".$_SESSION['personaname']."', '".$_SESSION['steamid']."', '".$_SESSION['avatar']."')";

You're referencing $_SESSION['personaname'], however, only ['steam_personaname'] is provided in the session. So you're referencing something that isn't there.

So you should be using:

$sql_steam = "INSERT INTO member (name, steamid, avatar) VALUES  ('".$_SESSION['steam_personaname']."', '".$_SESSION['steamid']."', '".$_SESSION['steam_avatarfull']."')";