MINI Sh3ll
<?php
include('include/session.php');
include('config/mysql_crud.php');
$db = new Database();
$db->connect();
$db->select('homepage_functions','*',NULL,'flag=0','position ASC');
$homepage_functions = $db->getResult();
$db->select('homepage','*',NULL,"id=1 AND flag=0");
$row = $db->getResult();
?>
<!DOCTYPE html>
<html lang="en">
<?php include('header.php');?>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<?php include('nav.php');?>
<?php include('top_navigation.php');?>
<!-- page content -->
<div class="right_col" role="main">
<div class="">
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<form class="form-horizontal form-label-left" id="commentForm" method="post" action="homepage_edit_process.php" novalidate>
<div class="item form-group">
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="functions_heading"> Functions Heading <span class="required">*</span> </label>
<div class="col-md-9 col-sm-9 col-xs-12">
<input id="functions_heading" class="form-control col-md-7 col-xs-12" name="functions_heading" required="required" type="text" value="<?php echo $row[0]['functions_heading']; ?>">
</div>
<div class="col-md-1 col-sm-1 col-xs-12">
<input type="hidden" name="id" value="1" />
<button id="send" type="submit" class="btn btn-success">Update</button>
</div>
</div>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<div class="col-md-8 col-lg-8">
<h2> Homepage Functions </small></h2>
</div>
<div class="col-md-4 col-lg-4">
<div class="pull-right"><a href="homepage_functions_add.php" class="btn btn-success"><i class="icon-plus-sign"></i> Add Homepage Function </a></div>
</div>
<div class="clearfix"></div>
</div>
<div id="info" class="col-md-12">Status : Waiting for you to reorder</div>
<br/>
<?php if(isset($_SESSION['message'])) { ?>
<div class="col-lg-12">
<div class="alert alert-success">
<a href="#" class="close" data-dismiss="alert">×</a>
<strong><?php echo $_SESSION["message"]; ?></strong>
</div>
</div>
<?php unset($_SESSION['message']); } ?>
<div class="x_content">
<table id="datatable-checkbox" class="table table-striped table-bordered bulk_action">
<thead>
<tr>
<th>Sr.</th>
<th>Name</th>
<th>URL</th>
<th>Edit</th>
<th>Delete</th>
<th>Sort</th>
</tr>
</thead>
<tbody id="test-list" style="list-style:none; padding-top:20px;">
<?php
$i=1;
foreach($homepage_functions as $functions){
?>
<tr id="listItem_<?php echo $functions['id']; ?>">
<td> <?php echo $i; ?> </td>
<td> <?php echo html_entity_decode($functions['name'],ENT_QUOTES) ?> </td>
<td> <?php echo html_entity_decode($functions['url'],ENT_QUOTES) ?> </td>
<td><a class="btn btn-warning edit<?php echo $functions['id']; ?>" rel="<?php echo $functions['id']; ?>" href="homepage_functions_edit.php?id=<?php echo $functions['id']; ?>">Edit</a></td>
<td><a class="btn btn-danger global_delete del<?php echo $functions['id']; ?>" rel="<?php echo $functions['id']; ?>" bel="homepage_functions" href="javascript:void(0)">Delete</a></td>
<td class="handle text-center">
<img src="images/arrow.png" width="30" height="30" alt="move" class="handle" />
</td>
</tr>
<?php $i++; } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /page content -->
<!-- footer content -->
<?php include('footer.php');?>
<!-- /footer content -->
</div>
</div>
<script>
$(document).ready(function() {
$("#test-list").sortable({
handle: '.handle',
update: function() {
var order = $('#test-list').sortable('serialize');
$("#info").load("process_sortable_homepage_functions.php?" + order, function() {
var kk = 1;
$('.pos_no').each(function() {
$(this).html('Position: <span class= "namestyle" >' + kk + '</span>')
kk = kk + 1;
})
});
}
});
$('body').on('click','.global_delete',function(){
var table=$(this).attr('bel');
var id=$(this).attr('rel');
if(confirm('Are you sure you want to delete it?')==true) {
$.ajax({
type:'POST',
url:'delete.php',
data:'table='+table+'&id='+id,
success:function(){
$('.del'+id).parent().parent().fadeOut('slow');
}
})
}
})
});
</script>
</body>
</html>
OHA YOOOO