function SteamIDCheck($steamiduser) { $steamiduser = rtrim($steamiduser, "/"); // remove trailing backslash //Look for STEAM_0:1:6656620 variation if (preg_match("/^STEAM_/i", $steamiduser)) { $steamId64 = $this->IDto64($steamiduser); $steam_link = $this->getSteamLink($steamId64); $steam_id = strtoupper($steamiduser); $steamArray = array('steamid' => $steam_id, 'steamID64' => $steamId64, 'steam_link' => $steam_link); return $steamArray; //look for just steam id 64, 76561197973578969 } elseif (preg_match("/^[0-9]/i", $steamiduser)) { $steamID64 = $steamiduser; $steam_link = $this->getSteamLink($steamID64); $steamid = $this->IDfrom64($steamID64); $SteamQuery = new SteamQuery(); $Query = $SteamQuery->GetPlayerSummaries($steamID64); $test = $Query->response->players; if (empty($test)) { return false; } else { $steamArray = array('steamid' => $steamid, 'steamID64' => $steamID64, 'steam_link' => $steam_link); return $steamArray; } } else { //Look for characters if (preg_match("/^[a-z]/i", $steamiduser)) { //Find steamcommunity link if (preg_match("/(steamcommunity.com)+/i", $steamiduser)) { //look for 64 url http://steamcommunity.com/profiles/76561197973578969 if (preg_match("/(\\/profiles\\/)+/i", $steamiduser)) { $steamiduser = rtrim($steamiduser, "/"); $i = preg_split("/\\//i", $steamiduser); $size = count($i) - 1; $steamID64 = $i[$size]; $steam_link = $this->getSteamLink($steamID64); $steam_id = $this->IDfrom64($steamID64); $steamArray = array('steamid' => $steam_id, 'steamID64' => $steamID64, 'steam_link' => $steam_link); return $steamArray; } elseif (preg_match("/(\\/id\\/)+/i", $steamiduser)) { //look for vanity url http://steamcommunity.com/id/nineteeneleven $i = preg_split("/\\//i", $steamiduser); $size = count($i) - 1; $SteamQuery = new SteamQuery(); $steamID64 = $SteamQuery->ConvertVanityURL($i[$size]); $steamid = $this->IDfrom64($steamID64); $steam_link = $this->getSteamLink($steamID64); $steamArray = array('steamid' => $steamid, 'steamID64' => $steamID64, 'steam_link' => $steam_link); return $steamArray; } else { return false; } } else { //check if its just vanity url, nineteeneleven $SteamQuery = new SteamQuery(); $steamID64 = $SteamQuery->ConvertVanityURL($steamiduser); $steamid = $this->IDfrom64($steamID64); $steam_link = $this->getSteamLink($steamID64); if ($steamid == "STEAM_0:0:0") { return false; } else { $steamArray = array('steamid' => $steamid, 'steamID64' => $steamID64, 'steam_link' => $steam_link); return $steamArray; } } } else { //found nothing return false; } } }
<form id="SteamIDFinder" method="POST" action="index.php"> <input name="SteamID" type="text" id="SteamID" style="width:400;"></td> <input type="submit" name="SteamIDFinder" value="FIND EM!" form='SteamIDFinder' /> <br /> <?php include_once 'includes/class_lib.php'; if (isset($_POST['SteamID'])) { $SteamID = $_POST['SteamID']; $SteamQuery = new SteamQuery(); $SteamIDConvert = new SteamIDConvert(); $SteamArray = $SteamIDConvert->SteamIDCheck($SteamID); if (empty($SteamArray)) { exit("<h1>No Such User Found</h1>"); } $Query = $SteamQuery->GetPlayerSummaries($SteamArray['steamID64']); echo "Steam ID: " . $SteamArray['steamid'] . "<br />"; echo "Steam ID 64: " . $SteamArray['steamID64'] . "<br />"; echo "Steam Link: " . $SteamArray['steam_link'] . "<br />"; foreach ($Query->response->players as $player) { echo "<li>"; echo "<div class='PlayerHeader'>"; if (!empty($player->gameid)) { echo "<a href='" . $player->profileurl . "' target='_blank'><img src='" . $player->avatarmedium . "' class=PlayerAvatar style='border: 5px solid #8bc53f;'/></a>"; } else { echo "<a href='" . $player->profileurl . "' target='_blank'><img src='" . $player->avatarmedium . "' class=PlayerAvatar style='border: 5px solid #62a7e3;'/></a>"; } echo "<a href='" . $player->profileurl . "' target='_blank' class='PlayerName'>" . $player->personaname . "</a>"; echo "<a href='steam://friends/add/" . $player->steamid . "' style='font-size:8px;'> Add to Friends</a>"; echo "</div>"; echo "<br />";