<?php
$lcheck = "b";
$z = "b";
include("config.php");
$testquery = @mysql_query("SELECT * FROM ".$pre."games");
if (!$testquery) {
$z = "no";
}


$tem1 = file_get_contents(stripslashes("templates/".$maintheme."/top10-1.php"));


$tem2 = file_get_contents(stripslashes("templates/".$maintheme."/top10-2.php"));

$sql = mysql_query("SELECT * FROM ".$pre."games ORDER BY stats DESC LIMIT 10");
for($i = 1; $r = mysql_fetch_assoc($sql); $i++) {
$release = date($fdformat1, $r['release']);
$icon = mysql_fetch_row(mysql_query("SELECT name,icon FROM ".$pre."systems WHERE id = '".$r['system']."'"));
$album = mysql_fetch_row(mysql_query("SELECT name FROM ".$pre."albums WHERE id = '".$r['album']."'"));

$vate[0] = "{name}";
$vate[1] = "{stats}";
$vate[2] = "{username}";
$vate[3] = "{publisher}";
$vate[4] = "{developer}";
$vate[5] = "{genre}";
$vate[6] = "{release}";
$vate[7] = "{esrb}";
$vate[8] = "{boxart}";
$vate[9] = "{des}";
$vate[10] = "{id}";
if ($_COOKIE[username]) {
$vate[11] = "{favorites}";
$vate[12] = "{playing}";
$vate[13] = "{tracked}";
$vate[14] = "{collection}";
$vate[15] = "{wishlist}";
$vate[16] = "{rank}";
$vate[17] = "{system}";
$vate[18] = "{icon}";
$vate[19] = "{album}";
$tate[0] = "<a href='game".$r[id].fthrough($r[name], "").".html'>".$r[name]."</a>";
$tate[1] = $r[stats];
$tate[2] = $r[username];
$tate[3] = $r[publisher];
$tate[4] = $r[developer];
$tate[5] = $r[genre];
$tate[6] = $release;
$tate[7] = $r[esrb];
if ($r['boxart']) {
$tate[8] = "<img src='".$r['boxart']."' border='1' width='100'>";
} else {
$tate[8] = "<img src='a_images/noboxart.jpg'>";
}
$tate[9] = stripslashes($r[des]);
$tate[10] = $r[id];
$tate[11] = "<a href='javascript:awindow(\"index.php?view=elitef&id=".$r[id]."\", \"\", \"width=20,height=10,scroll=yes\")'><img src='a_images/elite_f.jpg' border='1'></a>";
$tate[12] = "<a href='javascript:awindow(\"index.php?view=elitep&id=".$r[id]."\", \"\", \"width=20,height=10,scroll=yes\")'><img src='a_images/elite_p.jpg' border='1'></a>";
$tate[13] = "<a href='javascript:awindow(\"index.php?view=elitet&id=".$r[id]."\", \"\", \"width=20,height=10,scroll=yes\")'><img src='a_images/elite_t.jpg' border='1'></a>";
$tate[14] = "<a href='javascript:awindow(\"index.php?view=elitec&id=".$r[id]."\", \"\", \"width=20,height=10,scroll=yes\")'><img src='a_images/elite_c.jpg' border='1'></a>";
$tate[15] = "<a href='javascript:awindow(\"index.php?view=elitew&id=".$r[id]."\", \"\", \"width=20,height=10,scroll=yes\")'><img src='a_images/elite_w.jpg' border='1'></a>";
$tate[16] = $i;
$tate[17] = $icon[0];
if ($icon[1]) {
$tate[18] = "<img src='".$icon[1]."'>";
} else {
$tate[18] = "";
}
$tate[19] = "<a href='".$gpart1.$r[album].fthrough($album[0], "").$gpart2."'>".$album[0]."</a>";

} else {
$vate[0] = "{name}";
$vate[1] = "{stats}";
$vate[2] = "{username}";
$vate[3] = "{publisher}";
$vate[4] = "{developer}";
$vate[5] = "{genre}";
$vate[6] = "{release}";
$vate[7] = "{esrb}";
$vate[8] = "{boxart}";
$vate[9] = "{des}";
$vate[10] = "{id}";
$vate[11] = "{favorites}";
$vate[12] = "{playing}";
$vate[13] = "{tracked}";
$vate[14] = "{collection}";
$vate[15] = "{wishlist}";
$vate[16] = "{rank}";
$vate[17] = "{system}";
$vate[18] = "{icon}";
$vate[19] = "{album}";
$tate[0] = "<a href='game".$r[id].fthrough($r[name], "").".html'>".$r[name]."</a>";
$tate[1] = $r[stats];
$tate[2] = $r[username];
$tate[3] = $r[publisher];
$tate[4] = $r[developer];
$tate[5] = $r[genre];
$tate[6] = $release;
$tate[7] = $r[esrb];
if ($r['boxart']) {
$tate[8] = "<img src='".$r['boxart']."' border='1' width='100'>";
} else {
$tate[8] = "<img src='a_images/noboxart.jpg'>";
}
$tate[9] = stripslashes($r[des]);
$tate[10] = $r[id];
$tate[11] = "";
$tate[12] = "";
$tate[13] = "";
$tate[14] = "";
$tate[15] = "";
$tate[16] = $i;
$tate[17] = $icon[0];
if ($icon[1]) {
$tate[18] = "<img src='".$icon[1]."'>";
} else {
$tate[18] = "";
}
$tate[19] = "<a href='".$gpart1.$r[album].fthrough($album[0], "").$gpart2."'>".$album[0]."</a>";
}
if ($i == "1") {
echo str_replace($vate, $tate, $tem1);
} else {
echo str_replace($vate, $tate, $tem2);
}
}
?>