title: Steam Openid login
body: <p>I am using steam open id to allow users to login to my website.  Here is what I have now.  Just a not I got this from a tutorial and changed it to match my needs.</p>
  
  <pre><code>&lt;?php
  include "apikey.php";
  include "OpenID.php";
     $link = mysql_connect('', '', '', ' ');
  if (!$link) {
  die('Could not connect: ' . mysql_error());
  }
  echo 'Connected successfully';
  
  
  
  $OpenID = new LightOpenID("MyWebsite");
  
  session_start();
  
  if(!$OpenID-&gt;mode) {
  
      if(isset($_GET['login'])) {
  
          $OpenID-&gt;identity = "http://steamcommunity.com/openid";
          header("Location: {$OpenID-&gt;authUrl()}");
      }
  
      if(!isset($_SESSION['T2SteamAuth'])){
           $login = print ('&lt;form action="?login" method="post"&gt;
      &lt;input type="image" src="http://cdn.steamcommunity.com/public/images/signinthroughsteam/sits_large_border.png"/&gt;
      &lt;/form&gt;');
      }
  
  }   elseif($OpenID-&gt;mode == "cancel") {
    echo "canceled";
  }   else {
       if(!isset($_SESSION['T2SteamAuth'])) {
  
           $_SESSION['T2SteamAuth'] = $OpenID-&gt;validate() ? $OpenID-&gt;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={$api}&amp;steamids={$Steam64}"); 
               $buffer = fopen("cache/{Steam64}.json". "w+");
               fwrite($buffer, $profile);
               fclose($buffer);
            }
            header("Location: login3.php");
       }
  
  }
      if(isset($_SESSION['T2SteamAuth'])) {
      $Steam64id = $_SESSION['T2SteamAuth'];
      print($Steam64id);
  $sql = "INSERT INTO ``.`` (`id`) VALUES ('$Steam64id')";
  mysql_query($sql, $link);
  mysql_close($link);
  print('&lt;form action = "?logout" method="post"&gt;&lt;button title="logout"          name="logout"&gt;Logout&lt;/button&gt;&lt;/form&gt;');
  }
  if(isset($_GET['logout'])) {
      unset($_SESSION['T2SteamAuth']);
      unset($_SESSION['T2SteamID64']);
      header("Location: login3.php");
  }   
  
  
  
  ?&gt;
  </code></pre>
  
  <p>This code allows users to login to my site and their id is sent to my database.  What I want to do is allow these users to use a forum.  I downloaded a forum plugin and open id but for some reason my code does not allow users to use my forum and I don't know why.  To get users to use my forum they have to go to wp-login.php and type in <a href="https://steamcommunity.com/openid/login" rel="nofollow">https://steamcommunity.com/openid/login</a> and then login that way, separately from my code.  I would like to have this code allow users to login to a forum.  Any help would be great.    Thanks</p>