I'm not gonna write it but here's an old Counter-Strike: Source rankings website I wrote for someone. If you learn this, you'll be able to easily make an armory page.
PHP Code:
<head>
<title>Counter-Strike: Source Stats</title>
<script src="sorttable.js" type="text/javascript"></script>
</head>
<?php
$mysqli = new mysqli ('address','username','password','database');
$query = "SELECT * FROM css_rank";
if( $result = $mysqli->query($query) ) {
echo "<table border='1', class='sortable''>";
echo "<thead><tr> <th>ID</th> <th>Name</th> <th>Kills</th> <th>Deaths</th> <th>K:D Ratio</th> <th>Headshots</th> <th>HS:K Ratio</th> <th>Headshot %</th> <th>Suicides</th> <th>Time Played</th> <th>Steam ID</th> <th>Steam Community</th> <th>Add As Friend</th> </tr></thead>";
while( $row = $result->fetch_object() ) {
//KD:R
if($row->deaths == 0 and $row->kills == 0){
$kdr = 0;}
elseif($row->deaths == 0){
$kdr = 1;}
else{
$kdr = $row->kills / $row->deaths;
}
//HK:R
if($row->headshots == 0 and $row->kills == 0){
$hkr = 0;}
elseif($row->kills == 0){
$hkr = 1;}
else{
$hkr = $row->headshots / $row->kills;
}
//HS%
if($row->kills == 0){
$headshotperc = 0;}
else{
$headshotperc = $row->headshots / $row->kills * 100;
}
//Played Time
$rtime = round($row->played_time,2);
if($rtime >= 60){
$time = $rtime / 60 .' mins';}
elseif($rtime >= 3600){
$time = $rtime / 60 / 60 .' hours';}
elseif($rtime >= 86400){
$time = $rtime / 60 / 60 / 24 .' days';}
else{
$time = $rtime .' secs';
}
//Community ID
$steamid = $row->steamId;
$community_id = ((substr($steamid, 10)) * 2) + 1197960265728 + (substr($steamid, 8, 1));
$community_id = rtrim(sprintf("%f", $community_id), "0");
$community_id = str_replace(".", "", $community_id);
$community_id= '7656'.$community_id;
echo "<tbody>";
echo "<tr><td>";
echo $row->rank_id;
echo "</td><td>";
echo utf8_decode($row->nick);
echo "</td><td>";
echo $row->kills;
echo "</td><td>";
echo $row->deaths;
echo "</td><td>";
echo round($kdr,2);
echo "</td><td>";
echo $row->headshots;
echo "</td><td>";
echo round($hkr,2);
echo "</td><td>";
echo round($headshotperc,2), "%";
echo "</td><td>";
echo $row->sucsides;
echo "</td><td>";
echo $time;
echo "</td><td>";
echo $row->steamId;
echo "</td><td>";
echo '<a href="http://steamcommunity.com/profiles/'.$community_id.'">View SteamID Page</a>';
echo "</td><td>";
echo '<a href="steam://friends/add/'.$community_id.'">Add As Friend</a>';
echo "</td></tr>";
echo "</tbody>";
$kdr = 0;
$headshotperc = 0;
$playedtime = 0;
}
echo "</table>";
} else {
echo $mysqli->error;
}
?>