Файл: public_html/page/adm-stats.php
Строк: 68
<?php
if (!defined('BASE_DIR')) { exit(header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true)); }
if (!isset($_SESSION['user_id'])) { exit(header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true)); }
if (!$users_info['status']) { exit(header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true)); }
$obEngine->addTitleHtml('Статистика сайта');
?>
<div id="message"><?php echo $msg = isset($_GET['msg']) ? printMessage((int)$_GET['msg']) : ''; ?></div>
<div class="wrapper">
<div class="main">
<div class="m_left">
<div class="m_title">Статистика сайта</div>
<span class="list-group-item" style="text-align: center; display: block; margin-bottom: 20px;">
<i class="fa fa-thumbs-down fa-button fa-fw" title="Выплаты" href="/adm-stats.php?mode=payment" onclick="location = $(this).attr('href');"></i>
<i class="fa fa-thumbs-up fa-button fa-fw" title="Пополнения" href="/adm-stats.php?mode=insert" onclick="location = $(this).attr('href');"></i>
</span>
<?php
if (isset($_GET['mode']))
{
switch ($_GET['mode'])
{
case 'payment':
$query = $mysqli->query("SELECT `id` FROM `".PREFIX."_history_out`");
$total = $query->num_rows;
$perpage = 25;
if (empty($_GET['p']) || $_GET['p'] <= 0)
{
$page = 1;
}
else
{
$page = (int)$_GET['p'];
}
$pages_count = ceil($total / $perpage);
if ($page > $pages_count) $page = $pages_count;
$start_pos = ($page - 1) * $perpage;
if ($start_pos < 0) $start_pos = 0;
$query = $mysqli->query("SELECT t1.*, t2.login as login, DATE_FORMAT(t1.time_add, '%d.%m.%y, %H:%i') as f_time_add FROM `".PREFIX."_history_out` AS t1 LEFT JOIN `".PREFIX."_users` AS t2 ON t1.user_id = t2.id LIMIT ".$start_pos.", ".$perpage."");
if ($query->num_rows)
{
?>
<table class="all_table" width="600" align="left" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="all_title">ID</td>
<td class="all_title">Дата заявки</td>
<td class="all_title">Пользователь</td>
<td class="all_title">Платёжная система</td>
<td class="all_title">Сумма</td>
<td class="all_title">Статус</td>
<td class="all_title"></td>
</tr>
<?php
$arr_paysystem = ['wmr' => 'WebMoney', 'payeer' => 'Payeer'];
while ($row = $query->fetch_assoc())
{
?>
<tr>
<td class="all_mid"><?php echo $row['id']; ?></td>
<td class="all_mid"><?php echo $row['f_time_add']; ?></td>
<td class="all_mid"><?php echo $row['login']; ?></td>
<td class="all_mid"><?php echo $arr_paysystem[$row['payment']]; ?></td>
<td class="all_mid"><?php echo $row['money']; ?></td>
<?php
if ($row['status'] == 0)
{
?>
<td class="all_mid">В процессе</td>
<td class="all_mid" title="В процессе"><img src="img/loading.gif"></td>
<?php
}
else if ($row['status'] == 1)
{
?>
<td class="all_mid">Оплачено</td>
<td class="all_mid" title="Оплачено"><img src="img/ok.png"></td>
<?php
}
else
{
?>
<td class="all_mid">Отменено</td>
<td class="all_mid" title="Отменено"><img src="img/ex.png"></td>
<?php
}
?>
</tr>
<?php
}
?>
</table>
<?php
if ($total >= $perpage)
{
printPageNav($page, $pages_count, '/adm-stats.php', $total, $perpage);
}
}
break;
case 'insert':
$query = $mysqli->query("SELECT `id` FROM `".PREFIX."_history_pay`");
$total = $query->num_rows;
$perpage = 25;
if (empty($_GET['p']) || $_GET['p'] <= 0)
{
$page = 1;
}
else
{
$page = (int)$_GET['p'];
}
$pages_count = ceil($total / $perpage);
if ($page > $pages_count) $page = $pages_count;
$start_pos = ($page - 1) * $perpage;
if ($start_pos < 0) $start_pos = 0;
$query = $mysqli->query("SELECT t1.*, t2.login as login, DATE_FORMAT(t1.time_pay, '%d.%m.%y, %H:%i') as f_time_pay FROM `".PREFIX."_history_pay` AS t1 LEFT JOIN `".PREFIX."_users` AS t2 ON t1.user_id = t2.id LIMIT ".$start_pos.", ".$perpage."");
if ($query->num_rows)
{
?>
<table class="all_table" width="600" align="left" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="all_title">ID</td>
<td class="all_title">Дата оплаты</td>
<td class="all_title">Пользователь</td>
<td class="all_title">Что купил</td>
<td class="all_title">Платёжная система</td>
<td class="all_title">Сумма</td>
<td class="all_title">Статус</td>
<td class="all_title"></td>
</tr>
<?php
//$arr_paysystem = ['wmr' => 'WebMoney', 'payeer' => 'Payeer', 'Баланс' => 'Баланс'];
while ($row = $query->fetch_assoc())
{
?>
<tr>
<td class="all_mid"><?php echo $row['id']; ?></td>
<td class="all_mid"><?php echo $row['f_time_pay']; ?></td>
<td class="all_mid"><?php echo $row['login']; ?></td>
<td class="all_mid"><?php if ($row['type'] == 1) { echo 'Пополнение баланса'; } else if ($row['type'] == 2) { echo 'Покупка ссылок'; } else if ($row['type'] == 3) { echo 'Покупка баннеров'; } ?></td>
<td class="all_mid"><?php echo $row['payment']; ?></td>
<td class="all_mid"><?php echo $row['price']; ?></td>
<?php
if ($row['status'] == 0)
{
?>
<td class="all_mid">В процессе</td>
<td class="all_mid" title="В процессе"><img src="img/loading.gif"></td>
<?php
}
else if ($row['status'] == 1)
{
?>
<td class="all_mid">Оплачено</td>
<td class="all_mid" title="Оплачено"><img src="img/ok.png"></td>
<?php
}
else
{
?>
<td class="all_mid">Отменено</td>
<td class="all_mid" title="Отменено"><img src="img/ex.png"></td>
<?php
}
?>
</tr>
<?php
}
?>
</table>
<?php
if ($total >= $perpage)
{
printPageNav($page, $pages_count, '/adm-stats.php', $total, $perpage);
}
}
break;
default:
break;
}
}
?>
</div>
<?php include 'module/user_menu.php'; ?>
</div>
</div>