hjkhhrterwefdgdfgdfgdfgdgdfgdfgdsvstertrt
bnmbertsdfsdfgdfgdfgfffdgdfgdfgrtdfg
/
home
/
u254050281
/
domains
/
indiannadarcouncil.in
/
public_html
/
apanel
/
Upload FileeE
HOME
<?php session_start(); if(!isset($_SESSION['loginid']) && !isset($_SESSION['UserName'])){ header("Location:index.php"); } include("leftmenu.php"); include("db.php"); if((isset($_REQUEST['id'])) && ($_REQUEST['actions'])=='Delete'){ $id=$_GET['id']; $sql="DELETE FROM blogs WHERE id=$id"; $res=mysqli_query($db,$sql); if($res){ $_SESSION['del_msg']="<h5 id='delete_message' style='color:red;padding:10px;text-align:center;'>Blog Details Deleted Successfully</h5>"; } } ?> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <div class="container-fluid"> <div class="row mb-2"> <div class="col-sm-6"> <h1>Blog</h1> </div> <div class="col-sm-6"> <ol class="breadcrumb float-sm-right"> <li class="breadcrumb-item"><a href="dashboard.php">Home</a></li> <li class="breadcrumb-item active">Blog List</li> </ol> </div> </div> </div><!-- /.container-fluid --> </section> <!-- Main content --> <section class="content"> <div class="container-fluid"> <div class="row"> <div class="col-12"> <!-- /.card --> <div class="card"> <div class="card-header"> <h3 class="card-title">Blog Lists</h3> <div class="card-tools"> <a href="new-blog.php"><button type="button" class="btn btn-info">Add Blog</button></a> </div> </div> <?php if(isset($_SESSION['del_msg'])){ echo $_SESSION['del_msg']; unset($_SESSION['del_msg']); } ?> <!-- /.card-header --> <div class="card-body"> <table id="example1" class="table table-bordered table-striped"> <thead> <tr> <th>S.No</th> <th>Name</th> <th>Blog Image</th> <th>Date</th> <th>Action</th> </tr> </thead> <tbody> <?php $i=1; $sql="SELECT * FROM blogs ORDER BY id DESC"; $res=mysqli_query($db,$sql); while($rec=mysqli_fetch_assoc($res)){ ?> <tr> <td><?php echo $i; ?></td> <td><?php echo $rec['name']; ?></td> <td><img src="images/blogs/<?php echo $rec['blog_image'];?>" width="100px" height="100px"></td> <td><?php echo $rec['date']; ?></td> <td class="project-actions text-right"> <a class="btn btn-info btn-sm" href="new-blog.php?id=<?php echo $rec['id'];?>&action=Edit"> <i class="fas fa-pencil-alt"></i> </a> <button class="btn btn-danger btn-sm delete" data-id="<?php echo $rec['id'];?>"><i class="fas fa-trash"></i> </button> </td> </tr> <?php $i++; } ?> </tbody> <tfoot> <tr> <th>S.No</th> <th>Name</th> <th>Blog Image</th> <th>Date</th> <th>Action</th> </tr> </tfoot> </table> </div> <!-- /.card-body --> </div> <!-- /.card --> </div> <!-- /.col --> </div> <!-- /.row --> </div> <!-- /.container-fluid --> </section> <!-- /.content --> </div> <!-- /.content-wrapper --> <!-- /.control-sidebar --> </div> <!-- ./wrapper --> <!-- jQuery --> <?php include("footer.php"); ?> <script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/8.11.8/sweetalert2.all.js"></script> <!-- Page specific script --> <script> $(document).on("click",".delete", function () { var el = this; var id=$(this).data('id'); Swal.fire({ title: 'Are you sure?', text: "You want to delete the blogs", icon: 'warning', showCancelButton: true, confirmButtonColor: '#d33', cancelButtonColor: '#0D9B2C', confirmButtonText: 'Yes' }).then((result) => { if (result.value) { $.ajax({ url: 'ajax-call.php', type: 'POST', data:{'page':"blogs","id":id,"act":"DeleteData"}, success: function(response){ if(response == 1){ // Remove row from HTML Table $(el).closest('tr').css('background','tomato'); $(el).closest('tr').fadeOut(800,function(){ $(this).remove(); Swal.fire( 'Deleted!', 'Blogs Deleted.', 'success' ) }); }else{ alert('Invalid ID.'); } } }); } else if ( /* Read more about handling dismissals below */ result.dismiss === Swal.DismissReason.cancel ) { // Swal.fire( // 'Cancelled', // 'Your imaginary file is safe :)', // 'error' // ) } }) }); </script>