<?php
require_once('../wu_init.php');
if (!wu_token()) { exit('wu-error'); }
if (!USER_LOGGED) { exit('wu-error'); }
include('wu_checkadmin.php');
include('../wu-functions/wu_functions.php');

if(isset($_POST['usr'])){
if(!empty($_POST['usr'])){
$usr = intval($_POST['usr']);

$qr = mysqli_query($connect_db, "SELECT uid,log,regdate,regip,last,av,rat,toref FROM ".DB_PREFIX."_users WHERE ref='$usr' ORDER BY uid DESC");
if (mysqli_num_rows($qr) > 0) {
?>
<div class="table-responsive img40">
<table class="table table-hover text-center">
<thead>
<tr>
<th class="text-center">Пользователь</th>
<th class="text-center">Прибыль</th>
<th class="text-center">Рейтинг</th>
<th class="text-center">Дата регистрации</th>
<th class="text-center">Последний вход</th>
<th class="text-center">Регистрационный IP</th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_assoc($qr)) {
if (empty($row['av'])) { $ava_link_thumb = '/wu-static/img/avatar_default.png'; $ava_link_full = '/wu-static/img/avatar_default.png'; } else { $ava_link_thumb = '/wu-uploads/avatars/thumbs/'.$row['av']; $ava_link_full = '/wu-uploads/avatars/full/'.$row['av']; }
?>
<tr>
<td>
<div class="lightgallerys">
<a href="<?php echo $ava_link_full; ?>" data-sub-html="Аватар пользователя <?php echo $row['log']; ?>"><img src="<?php echo $ava_link_thumb; ?>" alt="Аватар пользователя <?php echo $row['log']; ?>" /></a>
</div>
<div class="margt_5"><?php echo $row['log']; ?><br />(uid <?php echo $row['uid']; ?>)</div>
</td>
<td><?php echo number_format($row['toref'],2,'.',','); ?> руб.</td>
<td><?php echo $row['rat']; ?></td>
<td><?php echo wudate($row['regdate']); ?></td>
<td><?php echo wudate($row['last']); ?></td>
<td><?php echo $row['regip']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php
} else { echo '<div class="alert alert-info fade in"><i class="icon-info"></i> Рефералов нет</div>'; }
} else { exit('wu-error'); }
} else { exit('wu-error'); }
?>