OverLord Shell
<?php
/*
@Purpose: Add product List
@Author: Rajahree
@CreatedOn: 12 April 2016
@ModifiedOn: 12 April 2016
*/
error_reporting(0);
session_start();
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");}
require_once("../db/conn.php");
$pagename=substr(basename($_SERVER['PHP_SELF']),0,-4);
$webpagetitle="Product Photos";
include("header.php");
if(isset($_GET['id']))
{
$id = base64_decode($_GET['id']);
}
$_SESSION['product_id'] = (!empty($id))? base64_decode($_GET['id']):$_SESSION['product_id'];
?>
<?php if(in_array($_SESSION['loggedin_user'],array('admin','company'))){?>
<a href="<?php echo $pagename?>add.php" class="btn btn-primary pull-right">Add New<i class="fa fa-plus mlm"></i></a>
<?php }?>
<a href="javascript:void(0)" class="btn btn-info pull-right mrm" onClick="history.back()"><i class="fa fa-angle-left mrm"></i>Go Back</a>
<div class="clearfix"></div>
</div>
<!--BEGIN CONTENT-->
<div class="page-content">
<div class="row">
<div class="col-md-12">
<div class="panel">
<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']=='add_success'){?>Added Successfully!!!<?php }?>
<?php if($_GET['msg']=='update_success'){?>Updated Successfully!!!<?php }?>
<?php if($_GET['msg']=='delete_success'){?>Record deleted Successfully<?php }?>
<?php if($_GET['msg']=='default_success'){?>Record status changed Successfully<?php }?>
</div>
<?php }?>
<div class="table-responsive">
<table class="table table-striped table-hover" id="dataTables-listing">
<thead>
<tr>
<th>Photo Name</th>
<?php if(in_array($_SESSION['loggedin_user'],array('admin','company'))){?>
<th class="text-center">View</th>
<th class="text-center">Default</th>
<th class="text-center">Edit</th>
<th class="text-center">Enable/Disable</th>
<th class="text-center">Delete</th>
<?php }?>
</tr>
</thead>
<tbody>
<?php
$listq="SELECT * FROM `busdir_product_photo` WHERE product_id = ".$_SESSION['product_id']." AND deleted = 'n'";
$listr=$connection->query($listq);
while($listrow=$listr->fetch_assoc()){
?>
<tr>
<td><?php echo $listrow['photo_path']?></td>
<td class="text-center"><a href="../uploads/products/<?php echo $listrow['photo_path']?>" class="btn btn-info btn-sm fancybox">View<i class="fa fa-eye mlm"></i></a></td>
<?php if(in_array($_SESSION['loggedin_user'],array('admin','company'))){?>
<td class="text-center"><button type="button" value="<?php echo $listrow['photo_id']."#".$_SESSION['product_id']; ?>" <?php $class = ($listrow['featured']=='n') ? 'class="btn btn-white featured"' : 'class="btn btn-default" disabled=""'; echo $class; ?> ><?php $option = ($listrow['featured']=='n') ? "Make Default<i class='fa fa-star-o mlm'></i>" : "Default<i class='fa fa-star mlm'></i>"; echo $option; ?></button>
</td>
<td class="text-center"><form><button type="submit" name="id" value="<?php echo base64_encode($listrow['photo_id'])?>" formaction="<?php echo $pagename?>edit.php" class="btn btn-primary btn-sm">Edit<i class="fa fa-pencil mlm"></i></button></form></td>
<td class="text-center"><button type="button" value="<?php echo $listrow['photo_id']?>" class="btn btn-sm btn-<?php if($listrow['active']!='n')echo "danger";else echo "success"?> delbtn"><?php if($listrow['active']=='n')echo 'Enable<i class="fa fa-check mlm"></i>';else echo 'Disable<i class="fa fa-close mlm"></i>'?></button></td>
<td class="text-center"><button type="button" value="<?php echo $listrow['photo_id']?>" class="btn btn-sm btn-warning recyclebtn">Delete<i class="fa fa-trash-o mlm"></i></button></td>
<?php }?>
</tr>
<?php }$listr->free()?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!--END CONTENT-->
<link type="text/css" rel="stylesheet" href="css/jquery.fancybox.css">
<script src="js/jquery.fancybox.pack.js"></script>
<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();
$(document).ready(function () {
if($('#msg').text() != "")
{
setTimeout(function () {
$('#msg').hide();
}, 5000);
var query = window.location.search.substring(1)
if(query.length) {
if(window.history != undefined && window.history.pushState != undefined) {
window.history.pushState({}, document.title, window.location.pathname);
}
}
}
});
$('.fancybox').fancybox();
</script>
<?php $connection->close();include("footer.php")?>
xRyukZ - Copyright 2k19