Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'id/openid.php';
- $_STEAMAPI = "paste your api here nigger";
- try
- {
- $openid = new LightOpenID('http://localhost/');
- if(!$openid->mode)
- {
- if(isset($_GET['login']))
- {
- $openid->identity = 'http://steamcommunity.com/openid/?l=english'; // This is forcing english because it has a weird habit of selecting a random language otherwise
- header('Location: ' . $openid->authUrl());
- }
- ?>
- <form action="?login" method="post">
- <input type="image" src="http://cdn.steamcommunity.com/public/images/signinthroughsteam/sits_small.png">
- </form>
- <?php
- }
- 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);
- $url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=$_STEAMAPI&steamids=$matches[1]";
- $json_object= file_get_contents($url);
- $json_decoded = json_decode($json_object);
- foreach ($json_decoded->response->players as $player)
- {
- //returned info
- $steamid = $player->steamid;
- $name = $player ->personaname;
- $avatar = $player ->avatar;
- }
- }
- else
- {
- echo '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script><script>
- $(document).ready(function(){
- alert("fff");
- });
- </script>';
- }
- }
- }
- catch(ErrorException $e)
- {
- echo $e->getMessage();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement