
PK 
<center>
<?php
if($_GET[saction]=="del" && $_GET[image_id]!=""){
$q = "select * from gallery_images where image_id = '$_GET[image_id]'";
$q = mysqli_query($conn,$q) or die(mysqli_error($conn));
if($r=mysqli_fetch_array($q)){
@unlink("../site_data/gallery_images/$r[image_file]");
@unlink("../site_data/gallery_images/th_$r[image_file]");
$q1="delete from gallery_images where image_id = '$_GET[image_id]'";
mysqli_query($conn,$q1) or die(mysqli_error($conn));
$msg="Record Deleted Successfully.";
}
}
?>
</center>
<!-- BEGIN PAGE LEVEL STYLES -->
<link rel="stylesheet" type="text/css" href="assets/global/plugins/select2/select2.css"/>
<link rel="stylesheet" type="text/css" href="assets/global/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.css"/>
<link rel="stylesheet" type="text/css" href="assets/global/plugins/bootstrap-markdown/css/bootstrap-markdown.min.css">
<link rel="stylesheet" type="text/css" href="assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css"/>
<!-- END PAGE LEVEL SCRIPTS -->
<!-- BEGIN CONTAINER -->
<!-- BEGIN CONTENT -->
<div class="page-content">
<!-- BEGIN PAGE HEADER-->
<h3 class="page-title">Gallery Images<small></small></h3>
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<i class="fa fa-home"></i>
<a href="main.php">Home</a>
<i class="fa fa-angle-right"></i>
</li>
</ul>
<!--<div class="page-toolbar">
<div class="btn-group pull-right">
<button type="button" class="btn btn-fit-height grey-salt dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="true">
Actions <i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li>
<a href="#">Action</a>
</li>
<li>
<a href="#">Another action</a>
</li>
<li>
<a href="#">Something else here</a>
</li>
<li class="divider">
</li>
<li>
<a href="#">Separated link</a>
</li>
</ul>
</div>
</div>-->
</div>
<!-- END PAGE HEADER-->
<!-- BEGIN PAGE CONTENT-->
<div class="row">
<!-- BEGIN SAMPLE TABLE PORTLET-->
<div class="portlet">
<div class="portlet-body">
<!-- Select Gallery
<select style="width:200px; display:inline;" class="form-control" id="gallery_id" name="gallery_id" onchange="window.location.href='main.php?paction=<?php echo $_GET[paction]?>&gallery_id='+this.value">
<option value="">Show All</option>
<?php
/*$q="select * from gallery order by titl";
$q=mysql_query($q) or die(mysql_error());
while($r=mysql_fetch_array($q)){
if($r[gallery_id]==$_GET[gallery_id]){
$sel="selected='selected'";
}else{
$sel="";
}
?>
<option value="<?php echo $r[gallery_id]?>" <?php echo $sel?>><?php echo $r[titl]?></option>
<?php
}*/
?>
</select> -->
<div class="table-scrollable">
<table class="table table-striped table-bordered table-advance table-hover">
<thead>
<tr>
<th width="5%" nowrap>Sr No</th>
<th>Image</th>
<th>Album</th>
<th>Image Details</th>
<th width="15%">Date</th>
<th style="text-align:center" width="150">Actions</th>
</tr>
</thead>
<tbody>
<?php
if($_GET[per_page]){
$noprd=$_GET[per_page];
}else{
$noprd=15;
}
$cpage=$_REQUEST['page'];
if ($cpage == 0){
$cpage=1;
$cnt=1;
}else{
$cnt=($cpage * $noprd) - $noprd + 1;
}
$frm=($cpage * $noprd) - $noprd;
$whr=1;
if($_GET[gallery_id]!=""){
$whr.=" and gallery_id='$_GET[gallery_id]' ";
}
$orderby=" order by image_id";
$query = "select * from gallery_images where $whr ";// where cate_id='$_GET[cate_id]' and status=1 ";
$sql=$query;
$query.=" $orderby LIMIT $frm, $noprd";
//echo "$query<br />";
$query = mysqli_query($conn,$query) or die (mysqli_error($conn));
while($row = mysqli_fetch_array($query)){
$q=" select * from gallery where gallery_id='$row[gallery_id]'";
$q = mysqli_query($conn,$q) or die (mysqli_error($conn));
if($rr = mysqli_fetch_array($q)){
$gallery=$rr[titl];
}else{
$gallery="";
}
?>
<tr>
<td align="center"><?=$cnt?></td>
<td><?php if($row[image_file]){?><img src="../site_data/gallery_images/th_<?php echo $row[image_file];?>" width="80" /><?php }?></td>
<td><?php echo $gallery;?></td>
<td><?php echo $row[image_details];?></td>
<td><span class="label label-success"><?php echo date("d M Y h:i:s a", strtotime($row[dt]));?></span></td>
<td align="right">
<a href="main.php?paction=add_gallery_image&image_id=<?php echo $row[image_id]?>" class="btn default btn-xs purple">
<i class="fa fa-edit"></i> Edit </a>
<a href="javascript:del('main.php?paction=<?php echo $_GET[paction]?>&saction=del&image_id=<?php echo $row[image_id]?>');" class="btn default btn-xs black">
<i class="fa fa-trash-o"></i> Delete </a>
</td>
</tr>
<?php
$cnt++;
}
?>
</tbody>
</table>
</div>
<!-- Pagging -->
<div class="pagging">
<div class="right">
<?php
include('ps_pagination.php');
$pager = new PS_Pagination($conn, $sql, $noprd, 6, "paction=$_GET[paction]&gallery_id=$_GET[gallery_id]");
$pager->setDebug(false);
$pager->total_rows=$result;
$rs = $pager->paginate();
//echo $pager->renderFullNav();
echo $pager->renderFirst();
echo $pager->renderPrev("Back");
echo $pager->renderNav('<span>', '</span>');
echo $pager->renderNext("Next");
echo $pager->renderLast();
?>
</div>
</div>
<!-- End Pagging -->
</div>
</div>
<!-- END SAMPLE TABLE PORTLET-->
</div>
<!-- END PAGE CONTENT-->
</div>
<!-- END CONTENT -->
<!-- END CONTAINER -->


PK 99