Player Profile
|
query
("
SELECT
hlstats_PlayerUniqueIds.uniqueId,
CAST(LEFT(hlstats_PlayerUniqueIds.uniqueId,1) AS unsigned) + CAST('76561197960265728' AS unsigned) + CAST(MID(hlstats_PlayerUniqueIds.uniqueId, 3,10)*2 AS unsigned) AS communityId
FROM
hlstats_PlayerUniqueIds
WHERE
hlstats_PlayerUniqueIds.playerId = '$player'
");
list($uqid, $coid) = $db->fetch_row();
function fetchpage($page)
{
$domain="steamcommunity.com";
$indata="";
// $data=file_get_contents($page);
$fsock=fsockopen($domain, 80, $errno, $errstr,2);
if(!$fsock)
{
echo "Error: $errstr";
}
else
{
$request=sprintf("GET %s HTTP/1.1\r\nHost: %s\r\nConnection: Close\r\n\r\n",$page,$domain);
fwrite($fsock, $request);
while(!feof($fsock))
{
$indata.=fgets($fsock,1024);
}
fclose($fsock);
return $indata;
}
}
$page = "/profiles/$coid?xml=1";
$pagedata=fetchpage($page);
if( preg_match('/Location: (.*)/', $pagedata, $location) )
{
$page = trim($location[1]) . "?xml=1";
$pagedata = fetchpage($page);
}
preg_match('/(.*?)<\/onlineState>/', $pagedata, $results);
preg_match('/<\/avatarFull>/', $pagedata, $results2);
$status = ucwords($results[1]);
$avatar_full = $results2[1];
$avimg = getImage("/avatars/$player");
if ($avimg)
{
$avatar_full = $avimg['url'];
}
else if ($avatar_full == '' || $playerdata['blockavatar'] == '1')
{
$avatar_full = IMAGE_PATH."/unknown.jpg";
}
if ($status == '')
$status = '(Unknown)';
echo("");
?>
|
';
echo '' . htmlspecialchars($playerdata['lastName'], ENT_COMPAT) . ' ';
?>
|
" . $playerdata['country'] . '';
}
else
{
echo 'Location: (Unknown)';
}
?>
|
$prefix" . "$uqid";
?>
|
Status: |
Click here to add as friend
|
|
Member of Clan: |
' . htmlspecialchars($playerdata['clan_name'], ENT_COMPAT) . '';
}
else
echo '(None)';
?>
|
Real Name: |
' . htmlspecialchars($playerdata['fullName'], ENT_COMPAT) . '';
}
else
echo "(Not Specified)';
?>
|
E-mail Address: |
Not Specified)';
?>
|
Home Page: |
Not Specified)';
?>
|
Last Connect:* |
query
("
SELECT
DATE_FORMAT(eventTime, '%a. %b. %D, %Y @ %T')
FROM
hlstats_Events_Connects
WHERE
hlstats_Events_Connects.playerId = '$player'
ORDER BY
id desc
LIMIT
1
");
list($lastevent) = $db->fetch_row();
if ($lastevent)
echo $lastevent;
else
echo '(Unknown)';
?>
|
Total Connection Time: |
|
Average Ping:* |
query
("
SELECT
ROUND(SUM(hlstats_Events_Latency.ping) / COUNT(hlstats_Events_Latency.ping), 0) AS av_ping,
ROUND(ROUND(SUM(hlstats_Events_Latency.ping) / COUNT(ping), 0) / 2, 0) AS av_latency
FROM
hlstats_Events_Latency
WHERE
hlstats_Events_Latency.playerId = '$player'
");
list($av_ping, $av_latency) = $db->fetch_row();
if ($av_ping)
echo $av_ping." ms (Latency: $av_latency ms)";
else
echo '-';
?>
|
Favorite Server:* |
query
("
SELECT
hlstats_Events_Entries.serverId,
hlstats_Servers.name,
COUNT(hlstats_Events_Entries.serverId) AS cnt
FROM
hlstats_Events_Entries
INNER JOIN
hlstats_Servers
ON
hlstats_Servers.serverId = hlstats_Events_Entries.serverId
WHERE
hlstats_Events_Entries.playerId = '$player'
GROUP BY
hlstats_Events_Entries.serverId
ORDER BY
cnt DESC
LIMIT
1
");
list($favServerId, $favServerName) = $db->fetch_row();
echo " $favServerName ";
?>
|
Favorite Map:* |
query
("
SELECT
hlstats_Events_Entries.map,
COUNT(map) AS cnt
FROM
hlstats_Events_Entries
WHERE
hlstats_Events_Entries.playerId = '$player'
GROUP BY
hlstats_Events_Entries.map
ORDER BY
cnt DESC
LIMIT
1
");
list($favMap) = $db->fetch_row();
echo " $favMap ";
?>
|
Favorite Weapon:* |
query("
SELECT
hlstats_Events_Frags.weapon,
hlstats_Weapons.name,
COUNT(hlstats_Events_Frags.weapon) AS kills,
SUM(hlstats_Events_Frags.headshot=1) as headshots
FROM
hlstats_Events_Frags
LEFT JOIN
hlstats_Weapons
ON
hlstats_Weapons.code = hlstats_Events_Frags.weapon
WHERE
hlstats_Events_Frags.killerId=$player
GROUP BY
hlstats_Events_Frags.weapon
ORDER BY
kills desc, headshots desc
LIMIT
1
");
while ($rowdata = $db->fetch_row($result))
{
$fav_weapon = $rowdata[0];
$weap_name = htmlspecialchars($rowdata[1]);
}
if ($fav_weapon == '')
$fav_weapon = 'Unknown';
$image = getImage("/games/$game/weapons/$fav_weapon");
// Check if image exists
$weaponlink = "";
if ($image)
{
$cellbody = "\t\t\t\t\t$weaponlink";
}
else
{
$cellbody = "\t\t\t\t\t | $weaponlink$weap_name";
}
$cellbody .= "";
echo $cellbody;
?>
|