<?
if (!defined('webid')) {
    exit();
}

if ($_GET['type'] == 'reyting') {
    $top100 = mysql_query("SELECT avatar, id, username, reyting FROM tb_users ORDER BY reyting DESC LIMIT 30");
    $top100_tab = '<thead><tr><th width="50" align="center" style="padding: 5px; background: #ebebeb;">№</th><th align="left" style="padding: 5px; background: #ebebeb;">Пользователь</th><th width="100" align="center" style="padding: 5px; background: #ebebeb;">Рейтинг</th></tr></thead>';
    $top_num = 0;
    while ($top100_row = mysql_fetch_array($top100)) {
        $top_num++;
        $sho_top .= '
        <tr>
            <td align="center" style="color: #ADC010;" class="tlt">' . $top_num . '</td>
            <td class="tlt">
			    <div style="position: relative; margin-left: 5px; margin-top: 5px;">
				    <a href="/id' . $top100_row['id'] . '" ><img src="' . ROOT . '/avp/' . $top100_row['avatar'] . '" width="30" height="30" class="avatar" align="left" /></a>
					<a href="/id' . $top100_row['id'] . '" class="link" style="display: block; position: absolute; left: 41px; top: 17px;">' . $top100_row['username'] . '</a>
				    <font style="display: block; position: absolute; left: 41px; top: 3px;"> ID: ' . $top100_row['id'] . '</font>
				</div>
			</td>
            <td class="tlt" align="center" style="font-weight: bold;">' . (int)$top100_row['reyting'] . '</td>
        </tr>';
    }
} else
if ($_GET['type'] == 'task') {
    $top100 = mysql_query("SELECT avatar, id, username, taskreyt FROM tb_users ORDER BY taskreyt DESC LIMIT 30");
    $top100_tab = '<thead><tr><th width="50" align="center" style="padding: 5px; background: #ebebeb;">№</th><th align="left" style="padding: 5px; background: #ebebeb;">Пользователь</th><th width="100" align="center" style="padding: 5px; background: #ebebeb;">Выполнено</th></tr></thead>';
    $top_num = 0;
    while ($top100_row = mysql_fetch_array($top100)) {
        $top_num++;
        $sho_top .= '
        <tr>
            <td align="center" style="color: #ADC010;" class="tlt">' . $top_num . '</td>
            <td class="tlt">
			    <div style="position: relative; margin-left: 5px; margin-top: 5px;">
				    <a href="/id' . $top100_row['id'] . '" ><img src="' . ROOT . '/avp/' . $top100_row['avatar'] . '" width="30" height="30" class="avatar" align="left" /></a>
					<a href="/id' . $top100_row['id'] . '" class="link" style="display: block; position: absolute; left: 41px; top: 17px;">' . $top100_row['username'] . '</a>
				    <font style="display: block; position: absolute; left: 41px; top: 3px;"> ID: ' . $top100_row['id'] . '</font>
				</div>
			</td>
            <td class="tlt" align="center" style="font-weight: bold;">' . (int)$top100_row['taskreyt'] . '</td>
        </tr>';
    }
} else
if ($_GET['type'] == 'serf') {
    $top100 = mysql_query("SELECT avatar, id, username, visits FROM tb_users ORDER BY visits DESC LIMIT 30");
    $top100_tab = '<thead><tr><th width="50" align="center" style="padding: 5px; background: #ebebeb;">№</th><th align="left" style="padding: 5px; background: #ebebeb;">Пользователь</th><th width="100" align="center" style="padding: 5px; background: #ebebeb;">Просмотрено</th></tr></thead>';
    $top_num = 0;
    while ($top100_row = mysql_fetch_array($top100)) {
        $top_num++;
        $sho_top .= '
        <tr>
            <td align="center" style="color: #ADC010;" class="tlt">' . $top_num . '</td>
            <td class="tlt">
			    <div style="position: relative; margin-left: 5px; margin-top: 5px;">
				    <a href="/id' . $top100_row['id'] . '" ><img src="' . ROOT . '/avp/' . $top100_row['avatar'] . '" width="30" height="30" class="avatar" align="left" /></a>
				    <a href="/id' . $top100_row['id'] . '" class="link" style="display: block; position: absolute; left: 41px; top: 17px;">' . $top100_row['username'] . '</a>
			        <font style="display: block; position: absolute; left: 41px; top: 3px;"> ID: ' . $top100_row['id'] . '</font>
				</div>
			</td>
            <td class="tlt" align="center" style="font-weight: bold;">' . (int)$top100_row['visits'] . '</td>
        </tr>';
    }
} else
if ($_GET['type'] == 'money') {
    $top100 = mysql_query("SELECT avatar, id, username, paid FROM tb_users ORDER BY paid DESC LIMIT 30");
    $top100_tab = '<thead><tr><th width="50" align="center" style="padding: 5px; background: #ebebeb;">№</th><th align="left" style="padding: 5px; background: #ebebeb;">Пользователь</th><th width="100" align="center" style="padding: 5px; background: #ebebeb;">Заработано</th></tr></thead>
	';
    $top_num = 0;
    while ($top100_row = mysql_fetch_array($top100)) {
        $top_num++;
        $sho_top .= '
        <tr>
            <td align="center" style="color: #ADC010;" class="tlt">' . $top_num . '</td>
            <td class="tlt">
			    <div style="position: relative; margin-left: 5px; margin-top: 5px;">
				    <a href="/id' . $top100_row['id'] . '" ><img src="' . ROOT . '/avp/' . $top100_row['avatar'] . '" width="30" height="30" class="avatar" align="left" /></a>
					<a href="/id' . $top100_row['id'] . '" class="link" style="display: block; position: absolute; left: 41px; top: 17px;">' . $top100_row['username'] . '</a><br>
					<font style="display: block; position: absolute; left: 41px; top: 3px;"> ID: ' . $top100_row['id'] . '</font>
				</div>
			</td>
            <td class="tlt" align="center" style="font-weight: bold;">' . floatval($top100_row['paid']) . '</td>
        </tr>';
    }
}
?>
<div class="wrap_cont">
<h3>Топ 30</h3><br />
<div style="margin-top: -15px;" class="wrap_top100_menu"><a href="top=reyting">по рейтингу</a><a href="top=task">по заданиям</a><a href="top=serf">по серфингу</a><a href="top=money">по заработку</a></div><br /><br />
<table style="margin-top: -17px;" class="otab2" width="100%" cellspacing="1" cellpadding="0" border="0">
    <?
    echo $top100_tab;
    echo $sho_top;
    ?>
</table>
</div>