Server Address : 2a02:4780:a:760:0:37cc:13e2:3
Web Server : LiteSpeed
Uname : Linux uk-fast-web660.main-hosting.eu 5.14.0-570.55.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Oct 21 05:27:51 EDT 2025 x86_64
PHP Version : 7.4.33
<?php
require 'top.inc.php';
if(isset($_GET['type']) && $_GET['type']!=''){
$type=get_safe_value($conn,$_GET['type']);
$id=get_safe_value($conn,$_GET['id']);
if($type=='delete' && $id>0){
$get_img="select image from popular_products where id='$id'";
$res=mysqli_query($conn,$get_img);
if($res && mysqli_num_rows($res)>0){
$row=mysqli_fetch_assoc($res);
@unlink(SERVER_PATH."/images/others/".$row['image']);
}
mysqli_query($conn,"delete from popular_products where id='$id'");
}
if(($type=='active' || $type=='deactive') && $id>0){
$status = ($type=='active')?1:0;
mysqli_query($conn,"update popular_products set status='$status' where id='$id'");
}
}
$sql="select * from popular_products order by sort_order asc, id desc";
$res=mysqli_query($conn,$sql);
?>
<div class="content pb-0">
<div class="orders">
<div class="row">
<div class="col-xl-12">
<div class="card">
<div class="card-body">
<h4 class="box-title">Popular Products</h4>
<h4 class="box-link"><a href="manage_popular.php">Add Popular Item</a></h4>
</div>
<div class="card-body--">
<div class="table-stats order-table ov-h">
<table class="table ">
<thead>
<tr>
<th class="serial">#</th>
<th>ID</th>
<th>Title</th>
<th>Description</th>
<th>Image</th>
<th>Link</th>
<th>Sort</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$i=1;
while($row=mysqli_fetch_assoc($res)){?>
<tr>
<td class="serial"><?php echo $i; ?></td>
<td><?php echo $row['id']?></td>
<td><?php echo $row['title']?></td>
<td><?php echo $row['description']?></td>
<td><img src="<?php echo SITE_PATH."/images/others/".$row['image']?>" alt="" style="max-height:64px"></td>
<td><?php echo $row['link']?></td>
<td><?php echo $row['sort_order']?></td>
<td><?php echo $row['status']? 'Active':'Inactive'?></td>
<td>
<?php
echo "<span class='badge badge-edit'><a href='manage_popular.php?id=".$row['id']."' >Edit</a></span> ";
if($row['status']){
echo "<span class='badge badge-complete'><a href='?type=deactive&id=".$row['id']."'>Deactivate</a></span> ";
} else {
echo "<span class='badge badge-pending'><a href='?type=active&id=".$row['id']."'>Activate</a></span> ";
}
echo "<span class='badge badge-delete'><a href='?type=delete&id=".$row['id']."' >Delete</a></span>";
?>
</td>
</tr>
<?php $i++; } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php require 'footer.inc.php';?>