PK

ADDRLIN : /home/anibklip/msbhogalnsons.com/cms/
FLL :
Current File : /home/anibklip/msbhogalnsons.com/cms/manage_pages.php

<center>
<?php
if($_GET[saction]=="del" && $_GET[page_id]!=""){
	$q = "select * from content where page_id = '$_GET[page_id]'";
	$q = mysqli_query($conn,$q) or die(mysql_error());
	if($r=mysql_fetch_array($q)){
		$q1="delete from content where parent_id = '$_GET[page_id]'";
		mysqli_query($conn,$q1) or die(mysql_error());

		$q1="delete from content where page_id = '$_GET[page_id]'";
		mysqli_query($conn,$q1) or die(mysql_error());
		$msg="Record Deleted Successfully.";
	}
}

if(($_GET[sts]=="0" || $_GET[sts]=="1") && $_GET[page_id]!=""){
	$q1="update content set status=$_GET[sts] where page_id = '$_GET[page_id]'";
	mysqli_query($conn,$q1) or die(mysqli_error($conn));
	$msg="Record Status updated 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 -->

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<style>
#sortable tr { cursor:move; }

/*#sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
#sortable tr { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; height: 18px; }
#sortable li span { position: absolute; margin-left: -1.3em; }*/
</style>
<script>
$(function() {
//$( "#sortable" ).sortable();
$('#sortable tbody').sortable({
	axis: 'y',
	update: function (event, ui) {
		var data = $(this).sortable('serialize');

		// POST to server using $.post or $.ajax
		$.ajax({
			data: data,
			type: 'POST',
			url: 'ajax_page_sort.php'
		});
	}
});

$( "#sortable" ).disableSelection();
});
</script>

<!-- BEGIN CONTAINER -->
<!-- BEGIN CONTENT -->
<div class="page-content">
    <!-- BEGIN PAGE HEADER-->
    <h3 class="page-title">Manage Pages<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 red 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="main.php?paction=content">Add New</a>
                    </li>
                    <li class="divider"></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">
				
                <?php if($msg){?><div class="alert alert-success display-show"><button class="close" data-close="alert"></button><?=$msg?></div><?php }?>

				<div class="table-scrollable">
				  <table id="sortable" class="table table-striped table-bordered table-advance table-hover">
                    <thead>
                    <tr>
                        <th width="5%" nowrap>Sr No</th>
						<th>Page Name</th>
						<!-- <th>Menu</th> -->
                        <th style="text-align:center" width="150">Actions</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php
					if($_GET[per_page]){
						$noprd=$_GET[per_page];
					}else{
						$noprd=150;
					}
					$cpage=$_REQUEST['page'];
					if ($cpage == 0){
						$cpage=1;
						$cnt=1;
					}else{
						$cnt=($cpage * $noprd) - $noprd + 1;
					}
					$frm=($cpage * $noprd) - $noprd;
					if($_GET[sort]!=""){
						$orderby=" order by $_GET[sort]";
					}else{
						$orderby=" order by sort_id ";
					}

					$whr=1;
					//$whr.=" and country_id='$_GET[cid]' ";
					$query = "select * from content where $whr and parent_id=0 ";//  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)){
						?>
                        <tr id="order-<?php echo $row[page_id];?>">
                            <td align="center"><?=$cnt?></td>
                            <td><?php echo $row[titl];?></td>
                            <!-- <td>
							<?php
							if($row[typ]=="HT"){
								echo "Header Top";
							}elseif($row[typ]=="HB"){
								echo "Header Bottom";
							}elseif($row[typ]=="MM"){
								echo "Main Menu";
							}elseif($row[typ]=="FM"){
								echo "Footer Menu";
							}
							?>
							</td> -->
                            <!-- <td width="30" align="center">
								<?php
								if($row[status]){?>
									<a href="main.php?paction=<?php echo $_GET[paction]?>&page_id=<?php echo $row[page_id]?>&sts=0"><img src="active.png" /></a>
								<?php }else{?>
									<a href="main.php?paction=<?php echo $_GET[paction]?>&page_id=<?php echo $row[page_id]?>&sts=1"><img src="deactive.png" /></a>
								<?php }?>
							</td> -->
                            <td align="right">
                                <?php if($row[page_id]!=2){?>
								<a href="main.php?paction=content&page_id=<?php echo $row[page_id]?>" class="btn default btn-xs purple">
                                <i class="fa fa-edit"></i> Edit </a>
                                <?php }?>
                                <a href="javascript:del('main.php?paction=<?php echo $_GET[paction]?>&saction=del&page_id=<?php echo $row[page_id]?>');" class="btn default btn-xs black"><i class="fa fa-trash-o"></i> Delete </a>
                            </td>
                        </tr>

						<?php
						$q1= "select * from content where parent_id='$row[page_id]' order by sort_id ";
						$q1= mysqli_query($conn,$q1) or die (mysqli_error($conn));
						if(mysqli_num_rows($q1)){
							?>
							<tr>
							 <td colspan="5">
								<table class="table table-striped table-bordered table-advance table-hover">
									<?php
									$cnt1=1;
									while($row1 = mysql_fetch_array($q1)){
										?>
										<tr id="order-<?php echo $row1[page_id];?>">
											<td width="5%" align="center"><?=$cnt1?></td>
											<td><?php echo $row1[titl];?></td>
											<!-- <td width="30" align="center">
												<?php 
												if($row1[status]){?>
													<a href="main.php?paction=<?php echo $_GET[paction]?>&page_id=<?php echo $row1[page_id]?>&sts=0"><img src="active.png" /></a>
												<?php }else{?>
													<a href="main.php?paction=<?php echo $_GET[paction]?>&page_id=<?php echo $row1[page_id]?>&sts=1"><img src="deactive.png" /></a>
												<?php }?>
											</td> -->
											<td width="150" align="right">
												<a href="main.php?paction=content&page_id=<?php echo $row1[page_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&page_id=<?php echo $row1[page_id]?>');" class="btn default btn-xs black">
												<i class="fa fa-trash-o"></i> Delete </a>
											</td>
										</tr>
										<?php
										$cnt1++;
									}
									?>
								</table>
							 </td>
							</tr>
                        <?php
						}
						$cnt++;
					}
					?>
                    </tbody>
                    </table>
                </div>
            </div>
        </div>
        <!-- END SAMPLE TABLE PORTLET-->
    </div>

    <!-- END PAGE CONTENT-->
</div>
<!-- END CONTENT -->
<!-- END CONTAINER -->


PK 99