Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ERROR | E_PARSE | E_WARNING);
  3.  
  4. $user = new user;
  5. $user->apikey = "432A96133FE54611C311E06A29463B98"; // put your API key here
  6. $user->domain = "http://dz-gaming.com/"; // put your domain
  7.  
  8.  
  9. class user
  10. {
  11. public static $apikey;
  12. public static $domain;
  13.  
  14. public function GetPlayerSummaries ($steamid)
  15. {
  16. $response = file_get_contents('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' . $this->apikey . '&steamids=' . $steamid);
  17. $json = json_decode($response);
  18. return $json->response->players[0];
  19. }
  20.  
  21. public function GetSchemaForGame (){
  22. $response = file_get_contents('http://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v2/?key=' . $this->apikey . 'appid=730');
  23. $json = json_decode($response);
  24. return $json->response->players[0];
  25. }
  26.  
  27. public function signIn ()
  28. {
  29. require_once 'openid.php';
  30. $openid = new LightOpenID($this->domain);// put your domain
  31. if(!$openid->mode)
  32. {
  33. $openid->identity = 'http://steamcommunity.com/openid';
  34. header('Location: ' . $openid->authUrl());
  35. }
  36. elseif($openid->mode == 'cancel')
  37. {
  38. print ('User has canceled authentication!');
  39. }
  40. else
  41. {
  42. if($openid->validate())
  43. {
  44. preg_match("/^http:\/\/steamcommunity\.com\/openid\/id\/(7[0-9]{15,25}+)$/", $openid->identity, $matches); // steamID: $matches[1]
  45. setcookie('steamID', $matches[1], time()+(60*60*24*7), '/'); // 1 week
  46. header('Location: /skinbag/index4.php');
  47. exit;
  48. }
  49. else
  50. {
  51. print ('fail');
  52. }
  53. }
  54. }
  55. }
  56.  
  57. if(isset($_GET['login']))
  58. {
  59. $user->signIn();
  60. }
  61. if (array_key_exists( 'logout', $_POST ))
  62. {
  63. setcookie('steamID', '', -1, '/');
  64. header('Location: /skinbag/index4.php');
  65. }
  66.  
  67.  
  68. if(!$_COOKIE['steamID'])
  69. {
  70. print ('<form action="?login" method="post">
  71. <input type="image" src="http://cdn.steamcommunity.com/public/images/signinthroughsteam/sits_large_border.png"/>
  72. </form>');
  73. }
  74. else
  75. {
  76. print('<form method="post"><button title="Logout" name="logout">Logout</button></form>');
  77. echo "Hello my name is ".$user->GetPlayerSummaries($_COOKIE['steamID'])->personaname." and this is my profile image <img src=".$user->GetPlayerSummaries($_COOKIE['steamID'])->avatar."></img>";
  78. echo "<br><br>steamid: ". $user->GetPlayerSummaries($_COOKIE['steamID'])->steamid;
  79. echo "<br>realname: ". $user->GetPlayerSummaries($_COOKIE['steamID'])->realname;
  80. echo "<br>profileurl: ". $user->GetPlayerSummaries($_COOKIE['steamID'])->profileurl;
  81.  
  82. $ArrayData = $user->GetSchemaForGame()->game->availableGameStats->achievements;
  83.  
  84. foreach ($ArrayData as &$value) {
  85. echo "<br>" . $value->icon;
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement