Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.92 KB | None | 0 0
  1. <?php
  2. require 'id/openid.php';
  3. $_STEAMAPI = "paste your api here nigger";
  4. try
  5. {
  6.     $openid = new LightOpenID('http://localhost/');
  7.     if(!$openid->mode)
  8.     {
  9.         if(isset($_GET['login']))
  10.         {
  11.             $openid->identity = 'http://steamcommunity.com/openid/?l=english';    // This is forcing english because it has a weird habit of selecting a random language otherwise
  12.             header('Location: ' . $openid->authUrl());
  13.         }
  14. ?>
  15. <form action="?login" method="post">
  16.     <input type="image" src="http://cdn.steamcommunity.com/public/images/signinthroughsteam/sits_small.png">
  17. </form>
  18. <?php
  19.     }
  20.     elseif($openid->mode == 'cancel')
  21.     {
  22.         echo 'User has canceled authentication!';
  23.     }
  24.     else
  25.     {
  26.         if($openid->validate())
  27.         {
  28.                 $id = $openid->identity;
  29.              
  30.                 $ptn = "/^http:\/\/steamcommunity\.com\/openid\/id\/(7[0-9]{15,25}+)$/";
  31.                 preg_match($ptn, $id, $matches);
  32.  
  33.                 $url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=$_STEAMAPI&steamids=$matches[1]";
  34.                 $json_object= file_get_contents($url);
  35.                 $json_decoded = json_decode($json_object);
  36.  
  37.                 foreach ($json_decoded->response->players as $player)
  38.                 {
  39.                     //returned info
  40.                 $steamid = $player->steamid;
  41.                 $name = $player ->personaname;
  42.                 $avatar = $player ->avatar;
  43.                
  44.                
  45.                      
  46.                  
  47.                    
  48.                 }
  49.  
  50.         }
  51.         else
  52.         {
  53.                 echo '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script><script>
  54.  $(document).ready(function(){
  55.    alert("fff");
  56.  });
  57. </script>';
  58.         }
  59.     }
  60. }
  61. catch(ErrorException $e)
  62. {
  63.     echo $e->getMessage();
  64. }
  65. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement