OverLord Shell
<?php
session_start();
include("db/conn.php");
include_once("headerdash.inc.php");
include("sidebar.php");
if(!isset($_SESSION['company_id']) || !isset($_SESSION['company_name'])){session_destroy();header("location:login.php");}
if(!in_array($_SESSION['loggedin_user'],array('admin','company'))){
header("location:404.php");
}
$pagename=substr(basename($_SERVER['PHP_SELF']),0,-4);
$webpagetitle="Products / Services ";
unset($_SESSION['product_id']);
?>
<!--BEGIN CONTENT-->
<div class="page-content">
<div class="row">
<div class="col-md-8" style="width: 72.666667%;">
<div class="panel">
<fieldset>
<legend><h3 style="color: #eb2c33; padding-bottom: 3%;"><?php
echo $webpagetitle ?> <span style="float:right !important;"><?php if(in_array($_SESSION['loggedin_user'],array('admin','company'))){?>
<a href="<?php echo $pagename?>add.php" class="btn btn-primary pull-right"style=" margin-right: 4%; margin-top: 1%;margin-bottom: 1%;">Add New<i class="fa fa-plus mlm"></i></a>
<?php }?></span> </h3></legend>
<div class="panel-body">
<?php if(!empty($_GET['msg']) && strpos($_GET['msg'],'success')!=FALSE){?>
<div class="note note-success note-dismissable" id="msg">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php if($_GET['msg']=='register_success'){?>Product added Successfully<?php }?>
<?php if($_GET['msg']=='update_success'){?>Record updated Successfully<?php }?>
<?php if($_GET['msg']=='delete_success'){?>Record deleted Successfully<?php }?>
</div>
<?php }?>
<div class="table-responsive">
<table class="table table-hover" id="dataTables-listing">
<thead>
<tr>
<th>Products/Services Name</th>
<th>Company Name</th>
<th>Category</th>
<th>Sub category</th>
<th class="text-center">Images</th>
<th class="text-center">View</th>
<th class="text-center">Enable / Disable</th>
<th class="text-center">Delete</th>
</tr>
</thead>
<tbody>
<?php
/*
$comp_id=base64_decode($_GET['id']);
if($comp_id!='')
{
$listq="SELECT * FROM busdir_product where my_company_id='".$comp_id."' and company_id='".$_SESSION['company_id']."' ";
}else{
$listq="SELECT * FROM busdir_product where company_id='".$_SESSION['company_id']."' and deleted='n' and active=''";
}*/
$listq="SELECT a.product_name,a.active,b.company_name,a.subcatid,a.catid,a.product_id FROM busdir_product a INNER JOIN busdir_mst_all_company b ON a.my_company_id = b.my_company_id where a.company_id ='".$_SESSION['company_id']."'and b.active='y'and b.deleted='n'and a .deleted='n'";
$listr=$connection->query($listq);
while($listrow=$listr->fetch_assoc()){
if($listrow==''){
?> <tr> <td colspan=8></td> </tr> <?php }else {?>
<tr>
<td><?php
echo $listrow['product_name']?></td>
<td><?php echo $listrow['company_name']?></td>
<td><?php
$catid=$listrow['catid'];
$list1="select * from busdir_mst_category where catid=$catid ";
//echo $list1;exit;
$list1r=$connection->query($list1);
$listrow1=$list1r->fetch_assoc();
echo $listrow1['categoryname']?></td>
<td><?php
$subcatid=$listrow['subcatid'];
$list1="select * from busdir_mst_subcategory where subcatid=$subcatid ";
//echo $list1;exit;
$list1r=$connection->query($list1);
$listrow1=$list1r->fetch_assoc();
echo $listrow1['subcategoryname']?></td>
<td class="text-center"><form><button type="submit" name="id" class="btn btn-info btn-sm" value="<?php echo base64_encode($listrow['product_id'])?>" formaction="<?php echo $pagename?>_photo.php">Manage<i class="fa fa-photo mlm"></i></button></form></td>
<?php if(in_array($_SESSION['loggedin_user'],array('admin','company'))){?>
<td class="text-center"><form><button type="submit" name="id" value="<?php echo base64_encode($listrow['product_id'])?>" formaction="<?php echo $pagename?>view.php" class="btn btn-primary btn-sm">View<i class="fa fa-pencil mlm"></i></button></form></td>
<td class="text-center">
<form>
<?php /*?><input type="hidden" name="id" value="<?php echo base64_encode($listrow['product_id']);?>" readonly><?php */?>
<button type="button" value="<?php echo $listrow['product_id']?>" class="btn btn-sm btn-<?php if($listrow['active']!='n')echo "danger";else echo "success"?> delbtn"><?php if($listrow['active']=='n')echo 'Make Enable<i class="fa fa-check mlm"></i>';else echo 'Make Disable<i class="fa fa-close mlm"></i>'?></button></form></a></td>
<input type="hidden" name="id" value="<?php echo base64_encode($listrow['areaid']);?>" readonly>
<td class="text-center"><button type="button" value="<?php echo $listrow['product_id']?>" class="recyclebtn btn btn-sm btn-warning ">Delete<i class="fa fa-trash-o mlm"></i></button></td>
<?php }?>
</tr>
<?php }?>
<?php }$listr->free()?>
</tbody>
</table>
</div>
</div>
</fieldset>
</div>
</div>
</div>
</div>
<!--END CONTENT-->
<link type="text/css" rel="stylesheet" href="css/dataTables/dataTables.bootstrap.min.css">
<script src="js/dataTables/jquery.dataTables.min.js"></script>
<script src="js/dataTables/dataTables.bootstrap.min.js"></script>
<script src="js/validate.js"></script>
<script>
//$('#dataTables-listing').dataTable();
$('#dataTables-listing').dataTable( {
"bSort": false
} );
</script>
<script>
if($('#msg').html()!==''){
setTimeout(function(){$('#msg').hide();},5000);
if(location.search.substring(1).length){if(history!==undefined && history.pushState!==undefined){history.pushState({}, document.title, location.pathname+'<?php if(isset($_GET['id']))echo "?id=".$_GET['id']?>');}}
}
</script>
<?php $connection->close();include("footer.inc.php")?>
xRyukZ - Copyright 2k19