<?php if(!defined('FastCore')){exit('Opss!');}
# Заголовок
$opt['title'] = 'Партнерская программа';
# Экономия места
$income = $user['income'];
$refs = $user['refs'];
$url = ('https://'.$_SERVER['HTTP_HOST']);
$lp = ($url.'/img/promo/');
?>
<!-- Page content -->
<div class="container-fluid ">
<div class="row">
<div class="col-lg-6">
<div class="card">
<div class="card-body">
<form action="" method="post" onsubmit="submitfromexchange(this);return false">
<div class="text-left h5 text-uppercase">Реферальная ссылка:</div>
<div class="input-group mb-2">
<div class="input-group-prepend"><span class="input-group-text"><i class="fa fa-link"></i></span></div>
<input type="text" onclick="this.select()" class="form-control" value="<?=$url.'/?ref='.$uid; ?>">
</div>
</form>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="row">
<div class="col-lg-6">
<div class="card card-stats mb-2">
<!-- Card body -->
<div class="card-body">
<div class="row">
<div class="col">
<span class="h2 font-weight-bold mb-0"><?=$income; ?></span>
<h5 class="card-title text-uppercase text-muted mb-0">доход</h5>
</div>
<div class="col-auto">
<div class="icon icon-shape bg-gradient-orange text-white rounded-circle shadow">
<span style=" font-size:9px" class="notranslate"> RUB</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="card card-stats mb-2">
<!-- Card body -->
<div class="card-body">
<div class="row">
<div class="col">
<span class="h2 font-weight-bold mb-0"><?=$refs; ?></span>
<h5 class="card-title text-uppercase text-muted mb-0">рефералов</h5>
</div>
<div class="col-auto">
<div class="icon icon-shape text-white rounded-circle shadow">
<i class="fa fa-users"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-12">
<div class="card card-stats">
<!-- Card body -->
<div class="card-body">
<div class="row">
<div class="col">
<h6 class="card-title text-uppercase mb-0 text-muted">Получай вознаграждение за приглашенных рефералов:</h6>
<h5 class="card-title text-uppercase mb-0"> - За каждое пополнение баланса = 15%</h5>
<h5 class="card-title text-uppercase mb-0"> - За 1 просмотр сайта = 0.0001 <span style=" font-size:9px" class="notranslate"> RUB</span></h5>
</div>
<div class="col-auto">
<div class="icon icon-shape text-white rounded-circle shadow">
<i class="fa fa-gift"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div id="demo" class="card p-3 collapse">
<div class="card-title">Рекламные материалы [баннеры].</div>
<div class="row">
<div class="col-md-8">
<div class="">
<div class="p-2"><h5 class="card-title">Размер баннера: <b>468х60</b></h5>
<img src="<?=$lp;?>2.png" alt="img">
<input type="text" onclick="this.select()" class="form-control mt-2" value="<?=$lp;?>2.png">
</div></div>
<!--div class="mt-2 mb-2">
<div class="p-2"><h5 class="card-title">Размер баннера: <b>728х90</b></h5>
<img src="<?=$lp;?>728.gif" style="width: 100%;" alt="img">
<input type="text" onclick="this.select()" class="form-control mt-2" value="<?=$lp;?>728.gif">
</div>
</div-->
</div>
<div class="col-md-4">
<div class="">
<div class="p-2"><h5 class="card-title">Размер баннера: <b>200х300</b></h5>
<img src="<?=$lp;?>3.png" alt="img">
<input type="text" onclick="this.select()" class="form-control mt-2" value="<?=$lp;?>3.png">
</div>
</div>
</div>
</div>
</div>
<br>
<div class="card">
<div class="card-header border-0">
<div class="row align-items-center">
<div class="col">
<h3 class="mb-0">Список рефералов</h3>
</div>
<div class="col">
<form action="" method="POST" style="width: 200px;">
<div class="input-group input-group-sm">
<input type="text" name="reflogin" class="form-control" placeholder="Введите логин" />
<div class="input-group-append"><input type="submit" class="btn btn-light" value="Найти" /></div>
</div>
</form>
</div>
<div class="col text-right">
<a href="/user/refs" class="btn btn-sm btn-primary">Весь список</a>
</div>
</div>
</div>
<div class="table-responsive">
<!-- Projects table -->
<table class="table table-striped align-items-center table-flush table-sm">
<thead class="thead-light">
<tr>
<th scope="col">Логин</th>
<th scope="col">Доход</th>
<th scope="col">Просмотры</th>
<th scope="col">Источник</th>
<th scope="col">Дата регистрации</th>
</tr>
</thead>
<tbody>
<?PHP
if (isset($_POST["reflogin"])) {
$searchRef = filter_var($_POST["reflogin"], FILTER_SANITIZE_STRING);
$ref = $db->query("SELECT login, ref_to, surf_view, refsite, reg FROM db_users WHERE rid = '$uid' AND login = '$searchRef'")->fetchAll();
}
else {
$ref = $db->query("SELECT login, ref_to, surf_view, refsite, reg FROM db_users WHERE rid = '$uid' ORDER BY ref_to DESC, surf_view DESC")->fetchAll();
}
foreach($ref as $r){
$surfs = $r['surf_view']/100;
?>
<tr>
<th scope="row"><?=$r['login']; ?></th>
<td><?=sprintf("%.4f",$r['ref_to']+$surfs); ?></td>
<td><?=$r['surf_view']; ?></td>
<td><?=$r['refsite']; ?></td>
<td><?=date("d.m.Y в H:i",$r['reg']); ?></td>
</tr>
<?PHP
}
?>
</tbody>
</table>
</div>
</div></div>
</div>