View file account/eshop_purchase.php

File size: 1.82Kb
<?php
$page_name = 'Покупки';
$page_keys = 'Покупки';
$page_desc = 'Покупки';
$online_title = 'На странице просмотра покупок';
$online_url = '/account/';
include('../wu-engine/wu_header.php');
if(!USER_LOGGED) { header ("Location: /"); exit; }
?>

<div class="panel panel-default">
<div class="panel-heading"><h6 class="panel-title"><i class="icon-bubbles4"></i> Мои покупки</h6></div>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr align="center">
<th>Дата покупки</th>
<th>Название товара</th>
<th>Товар</th>
</tr>
</thead>
<tbody>
<?php
$st = "SELECT ".DB_PREFIX."_es.id,m,un,".DB_PREFIX."_es_b.dt,inf,ty,ti,sec FROM `".DB_PREFIX."_es_b` INNER JOIN ".DB_PREFIX."_es ON ".DB_PREFIX."_es_b.m = ".DB_PREFIX."_es.id WHERE ".DB_PREFIX."_es_b.usr = '$u_id' ORDER BY ".DB_PREFIX."_es_b.id DESC";
$qt = mysqli_query($connect_db, $st);
$ht = mysqli_num_rows($qt);
if ($ht > 0) {
while($row = mysqli_fetch_array($qt)) {
?>
<tr>
<td><?php echo date('d.m.y H:i',$row['dt']); ?></td>
<td><a href="/eshop_show/<?php echo $row['m']; ?>" target="_blank"><?php echo $row['ti']; ?></a></td>
<td>
<?php if ($row['inf'] == 0 && $row['ty'] == 0) { echo '<a href="/wu-engine/wu-actions/eshop_item_download_reg/'.$row['id'].'">Скачать</a>'; } ?>
<?php if ($row['inf'] == 0 && $row['ty'] == 1) { echo nl2br(htmlspecialchars($row['sec'])); } ?>
<?php if ($row['inf'] == 1) { $unit = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT id,sec FROM ".DB_PREFIX."_es_u WHERE id = '$row[un]' LIMIT 1")); echo nl2br(htmlspecialchars($unit['sec'])); } ?>
</td>
</tr>
<?php } } else { echo '<tr><td colspan="3"><center>Нет купленных товаров</center></td></tr>'; } ?>
</tbody>
</table>
</div>
</div>

<?php include('../wu-engine/wu_footer.php'); ?>