<?php
$pname = 'Рефералы';
$pkey = 'рефералы';
$pdesc = 'Рефералы';
$prevurl_1 = 'cabinet';
$prevname_1 = 'Кабинет';
include('inc/top.php');
?>
<!-- Контент -->

<?php
$all = mysqli_num_rows(mysqli_query($connect_db, "SELECT uid,toref FROM `t_users` WHERE ref = '$u_id' ORDER BY uid DESC"));
$prf = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT SUM(toref) as `c` FROM t_users WHERE ref = '$u_id'"));
?>
<div class="gamehall_wrapper">
				<div class="index_gamehall_wrapper">
<div class="alert alert-success">
<center>
Ваша реферальная ссылка: <font color="#4682B4">http://<?php echo SITE; ?>/?ref=<?php echo $u_id; ?></font><br />
Всего рефералов: <font color="#4682B4"><?php echo $all; ?></font><br />
Получено с рефералов: <font color="#4682B4"><?php if (empty($prf['c'])) { echo 0; } else { echo $prf['c']; } ?> руб.</font>
</center>
</div>
<br />
<div class="panel panel-default">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Ник</th>
<th>Прибыль</th>
<th>Дата регистрации</th>
</tr>
</thead>
<tbody>
<?php
$reft = mysqli_query($connect_db, "SELECT uid,log,toref,dt FROM `t_users` WHERE ref = '$u_id' ORDER BY toref DESC");
if (mysqli_num_rows($reft) > 0) {
while($row = mysqli_fetch_array($reft)) {
?>
<tr>
<td><?php echo $row["log"]; ?></td>
<td><?php echo $row["toref"]; ?> руб.</td>
<td><?php echo date("d.m.y H:i",$row['dt']); ?></td>
</tr>
<?php
} } else { echo '<tr><td colspan="4"><center>Рефералов нет</center></td></tr>'; } ?>
</tbody>
</table>
</div>
</div></div>
</div>

<!-- /Контент -->
<?php include('inc/bottom.php'); ?>