public function testConvertUIdToCommunityId()
 {
     $steamId64 = SteamId::convertSteamIdToCommunityId('[U:1:12345]');
     $this->assertEquals('76561197960278073', $steamId64);
     $steamId64 = SteamId::convertSteamIdToCommunityId('[U:1:39743963]');
     $this->assertEquals('76561198000009691', $steamId64);
 }
 /**
  * Searches Steam for a user and returns their data if successful
  * 
  * @return json
  */
 public function search()
 {
     $id = Input::all()[0];
     // If the id is not fully numeric, assume it's a Steam ID, and convert it to a Community ID
     if (!is_numeric($id)) {
         try {
             $id = SteamId::convertSteamIdToCommunityId($id);
         } catch (Exception $e) {
             return $this->jsonResponse(400, false, $e->getMessage());
         }
     }
     // Grab user details from Steam
     try {
         $steamObject = new SteamId($id);
     } catch (Exception $e) {
         return $this->jsonResponse(400, false, $e->getMessage());
     }
     return $this->jsonResponse(200, true, 'User profile found!', ['community_id' => $steamObject->getSteamId64(), 'nickname' => $steamObject->getNickname(), 'avatar' => $steamObject->getMediumAvatarUrl()]);
 }
Пример #3
0
 public function testConvertSteamIdToCommunityId()
 {
     $steamId64 = SteamId::convertSteamIdToCommunityId('STEAM_0:0:12345');
     $this->assertType(PHPUnit_Framework_Constraint_IsType::TYPE_STRING, $steamId64);
     $this->assertEquals('76561197960290418', $steamId64);
 }
Пример #4
0
                $logtag = $row['logtag'];
                $message = htmlentities( $row['message'] );
                $time = $row['time_modified'];
                $name = $row['name'];
		    try {
		        $profile = SteamId::convertSteamIdToCommunityId($steamid);
		        }
			    catch(Exception $e) {
		            $profile = 'ERROR';
		        }
		preg_match_all($pattern, $message, $matches);
		$steamid2 = $matches[0][1];

		$statsinfo[3] = "right";
		if ($steamid != $steamid2 && $steamid2 != "") {
			$matchprofile = SteamId::convertSteamIdToCommunityId($steamid2);
			$statsinfo[2] = $steamid2;
			$matchurl = "<a href=http://steamcommunity.com/profiles/$matchprofile target=_blank>$steamid2></a>" . getstatsurl($statsinfo);
		}
		$message = str_replace($steamid2, $matchurl, $message);
		$statsinfo[2] = $steamid;
		echo "<tr class=\"elements\">
		<td width=\"200\" nowrap=\"nowrap\">$servername</td>
		<td width=\"200\" nowrap=\"nowrap\"><a href=\"http://steamcommunity.com/profiles/$profile\" title=\"$name\" target=_blank>$name" . getstatsurl($statsinfo) . "</a></td>
		<td width=\"120\" nowrap=\"nowrap\">$logtag</td>
		<td width=\"100%\">$message</td>
		<td width=\"120\" nowrap=\"nowrap\">$time</td>
		</tr>\n";
	}

	echo '</table><div style="clear:both;"></div></div>';
Пример #5
0
echo "<table>";
echo "<tr bgcolor=FF8C00><th width=14%>Name</th><th width=25%>Score</th><th width=14%>Ping</th><th width=14%>steamid</th><th width=14%>connect time</th><th width=14%>state</th><th width=14%>ip</th><th width=14% nowrap=nowrap>Quick Info</th></tr>";
$i=0;
foreach($players as $player) {
        $steamid = $player->getsteamid();
	$statsinfo[2] = $steamid;
	$name = $player->getName();
	if ($i%2 == 0) { echo "<tr class=d0>"; $i++; }
	else { echo "<tr class=d1>"; $i++; }
if ($name ==  "") { echo "<td>New player connecting</td>"; }
else { echo "<td>{$player->getName()}</td>"; }
    echo "<td>{$player->getScore()}</td>";
    echo "<td>{$player->getPing()}</td>";
    try {
	$profile = SteamId::convertSteamIdToCommunityId($steamid);
        }
    catch(Exception $e) {
	$profile = 'ERROR'; 
    }
//    $steamid = $player->getsteamid();
    echo "<td><a href=\"http://steamcommunity.com/profiles/$profile\" title=\"$name\" target=_blank>$steamid</a></td>";

    $seconds=$player->getconnectTime();
    $time=sec2hms($seconds);
    echo "<td>$time</td>";
    echo "<td>{$player->getstate()}</td>";
    echo "<td>{$player->getipaddress()}</td>";
	$statsinfo[3] = "none";
        $steamrep[0] = "steamrep";
        $steamrep[1] = "http://www.steamrep.com/profiles";