<h1 style="text-align: left;">
<img  src="style/img/top.png" align="center">Топ 100</h1>

<?php
db_connect();
$res = db_query("SELECT `login`, `regdat`, `game_win`, `game_loss`, `game_draw`, `rating`, `img` FROM `".DBpref."users` ORDER BY `rating` DESC");
db_close();

echo '
<table class="table1">
  <tr class="title">
    <td>Логин</td>
    <td>Зарегистрирован</td>
    <td>Побед</td>
    <td>Поражений</td>
    <td>Ничьих</td>
    <td>Рейтинг</td>
  </tr>
  ';
while($row = db_assoc($res)){
echo '
 <tr>
    <td><a target="_blank" href="/?p=wprofile&login='.htmlspecialchars($row["login"]).'"><img src="'.($row["img"] == NULL?"/upload/avatars/no.png":htmlspecialchars($row["img"])).'" height="60" width="60" alt="" / style="border: 1px solid rgb(187, 187, 187);"><br />'.htmlspecialchars($row["login"]).'</a></td>
    <td>'.substr($row["regdat"],0,10).'</td>
    <td>'.$row["game_win"].'</td>
    <td>'.$row["game_loss"].'</td>
    <td>'.$row["game_draw"].'</td>
    <td>'.round($row["rating"],4).'</td>
  </tr>
';
}
echo '</table>';
?>