<?php
if (!defined('webid')) {
    exit();
}
?>
<h3 style="border-bottom: 1px dotted #cccccc; color: #1c62b9; text-shadow: 0 1px 0 #fafafa;">Завершеные конкурсы</h3>
Список последних 15 завершенных конкурсов (отображается последний завершеный в верху<br />
<br>

<div style="text-align: center; color: #4682B4;"><a style="color: #4682B4;" href="/konkurs" ><u>Текущие конкурсы</u></a>&nbsp;|&nbsp;<a style="color: #4682B4;" href="/konkurs-end" ><u>Завершеныве конкурсы</u></a></div>
<br>


<table class="otab" width="100%" border="0" cellpadding="0" cellspacing="1">
    <thead>
        <th style="background: #ebebeb; padding: 3px;" width="15">№</th>
        <th style="background: #ebebeb; padding: 3px;" width="100">1-место</th>
        <th style="background: #ebebeb; padding: 3px;" width="100">2-место</th>
        <th style="background: #ebebeb; padding: 3px;" width="100">3-место</th>
        <th style="background: #ebebeb; padding: 3px;" width="100">тип</th>
    </thead>
<?
$konkurs_arhiv = mysql_query("SELECT * FROM konkurs_end ORDER BY id DESC LIMIT 15");
while ($row = mysql_fetch_array($konkurs_arhiv)) {
    $nameuser_konkurs_1 = mysql_fetch_array(mysql_query("SELECT username FROM tb_users WHERE id = '$row[user1]'"));
    $nameuser_konkurs_2 = mysql_fetch_array(mysql_query("SELECT username FROM tb_users WHERE id = '$row[user2]'"));
    $nameuser_konkurs_3 = mysql_fetch_array(mysql_query("SELECT username FROM tb_users WHERE id = '$row[user3]'"));
    
	if($row['type'] == 1) {$typeEndKonkurs = '<font style="color: #00BFFF;">кон. рекламодателя</font>';} else {$typeEndKonkurs = '<font style="color: #CD5C5C;">кон. рефералов</font>';}
	?>
    <tr>
        <td class="rt" align="left"><?=$row['id']?></td>
        <td class="rt" align="left"><?=$nameuser_konkurs_1['username']?></td>
        <td class="rt" align="center"><?=$nameuser_konkurs_2['username']?></td>
        <td class="rt" align="center"><?=$nameuser_konkurs_3['username']?></td>
        <td class="lt" align="center"><?=$typeEndKonkurs?></td>
    </tr>
    <?
}
?>
</table>