55ok

Mini

Direktori : /home/bestphotography/www/Admin/
Upload File :
Current File : /home/bestphotography/www/Admin/booknow.php

<?php
ini_set('memory_limit','2048M');
ini_set('max_execution_time', '0'); // for infinite time of execution
// Initialize the session
session_start();
include "config.php";
// Check if the user is logged in, if not then redirect him to login page
if(!isset($_SESSION["login"]) && $_SESSION["login"] !== true){
	header("location: index.php");
    exit;
}
$result = $conn->query('SELECT * FROM book_now ORDER BY bid desc');
?>
<?php
error_reporting(0);
if (isset($_POST["submit"])) {
    if (isset($_POST["ids"]) && count($_POST["ids"]) > 0 ) { // Added isset() check
        $all = implode(",", $_POST["ids"]);
        $sql = mysqli_query($conn, "DELETE FROM book_now WHERE bid IN ($all)");
        if ($sql) {
            echo '<script type="text/javascript">alert("Data has been deleted successfully");window.location.href = "./booknow.php";</script>';
        } else {
            echo '<script type="text/javascript">alert("Error while deleting. Please Try again.");</script>';
        }
    } else {
        echo '<script type="text/javascript">alert("You need to select at least one checkbox to delete!");</script>';
    }  
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <?php include "meta-title.php";?>
    <link rel="icon" href="assets/images/favicon/favicon.png" type="image/x-icon">
    <link rel="shortcut icon" href="assets/images/favicon/favicon.png" type="image/x-icon">
	<link rel="preconnect" href="https://fonts.googleapis.com/">
	<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
	<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&amp;display=swap" rel="stylesheet">
     <link rel="stylesheet" type="text/css" href="assets/css/vendors/font-awesome.css">
    <!-- ico-font-->
    <link rel="stylesheet" type="text/css" href="assets/css/vendors/icofont.css">
    <!-- Themify icon-->
    <link rel="stylesheet" type="text/css" href="assets/css/vendors/themify.css">
    <!-- Flag icon-->
    <link rel="stylesheet" type="text/css" href="assets/css/vendors/flag-icon.css">
    <!-- Feather icon-->
    <link rel="stylesheet" type="text/css" href="assets/css/vendors/feather-icon.css">
    <link rel="stylesheet" type="text/css" href="assets/css/vendors/scrollbar.css">
    <link rel="stylesheet" type="text/css" href="assets/css/vendors/datatables.css">
    <!-- Bootstrap css-->
    <link rel="stylesheet" type="text/css" href="assets/css/vendors/bootstrap.css">
    <!-- App css-->
    <link rel="stylesheet" type="text/css" href="assets/css/style.css">
    <link id="color" rel="stylesheet" href="assets/css/color-1.css" media="screen">
    <!-- Responsive css-->
    <link rel="stylesheet" type="text/css" href="assets/css/responsive.css">
  </head>
  <body>
    <!-- tap on top starts-->
    <div class="tap-top"><i data-feather="chevrons-up"></i></div>
    <!-- tap on tap ends-->
    <!-- Loader starts-->
    <div class="loader-wrapper">
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="dot"> </div>
      <div class="dot"></div>
    </div>
    <!-- Loader ends-->
    <!-- page-wrapper Start-->
    <div class="page-wrapper compact-wrapper" id="pageWrapper">
      <!-- Page Header Start-->
      <?php include "header.php";?>
      <!-- Page Header Ends-->
      <!-- Page Body Start-->
      <div class="page-body-wrapper">
        <!-- Page Sidebar Start-->
        <?php include "sidebar.php";?>
        <!-- Page Sidebar Ends-->
        <div class="page-body">
          <div class="container-fluid">
            <div class="page-title">
              <div class="row">
                <div class="col-sm-6">
                  <h3>Bookings</h3>
                </div>
                <div class="col-sm-6">
                  <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="dashboard.php">                                       <i data-feather="home"></i></a></li>
                    <li class="breadcrumb-item active">Bookings</li>
                  </ol>
                </div>
              </div>
            </div>
          </div>
          <!-- Container-fluid starts-->
          <div class="container-fluid">
            <div class="row">
              <div class="col-sm-12">
                <div class="card">                  
                  <div class="card-body">
                    <div class="row">
                      <div class=" table-responsive wishlist">
						<form name="multipledeletion" method="post">
						<div class="col-md-12" style="">
							<button style="float:right;margin-bottom:20px;" type="submit" name="submit" class="btn btn-square btn-primary" onClick="return confirm('Are you sure you want to delete?');" >Delete</button>
						</div>
						<br/>						
                        <table class="table table-bordered" id="basic-1">
                          <thead>
                            <tr>
							  <th><input type="checkbox" id="select_all" /></th>
                              <th>#</th>
							  <th>Date</th>
                              <th>Name</th>
                              <th>Mobile</th>
							  <th>E-mail</th>
							  <th>Services</th>
							  <th>Message</th>
                              <th>Status</th>
							  <th>Action</th>
                            </tr>
                          </thead>
                          <tbody>
						  <?php
						  if($result->num_rows>0) {
							  $i=1;
							  while($row = mysqli_fetch_array($result)) {
						  ?>
                            <tr>
							  <td><input type="checkbox" class="checkbox" name="ids[]" value="<?php echo htmlentities($row['bid']);?>"/></td>
							  <td valign="middle"><?php echo $i++;?></td>
							  <td valign="middle"><?php echo $row["createdon"] = date("d/m/Y", strtotime($row['createdon']));?></td>
                              <td valign="middle">
                                <div class="product-name"><h6><a href="javascript: void(0)" data-toggle="modal" data-id="<?php echo $row['bid']; ?>" class='eventinfo'><?php echo $row["name"];?></a></h6
								></div>
                              </td>
							  <td valign="middle"><?php echo $row["mobile"];?></td>
							  <td valign="middle"><?php echo $row["email"];?></td>
							  <td valign="middle"><?php echo $row["events"];?> | <?php echo $row["event_date"] = date("d/m/Y", strtotime($row['event_date']));?> | <?php echo $row["time"];?> | <?php echo $row["venue"];?> | <?php echo $row["insta_link"];?> |  <?php echo $row["requirement"];?> | <?php echo $row["budget"];?></td>
							  <td valign="middle"><?php echo $row["message"];?></td>
							  <td valign="middle"><?php echo $row["status"] == 0 ? "Pending" : "Completed" ;?></td>
                              <td valign="middle"><a href="javascript:;" onclick="delRow('<?php echo $row["bid"]?>')"><i class="edit-clr" data-feather="edit"></i></a></td>
                            </tr>
						  <?php 
							  }
						  }
						  ?>
                          </tbody>
                        </table>
						</form>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <!-- Container-fluid Ends-->
        </div>
        <!-- footer start-->
        <?php include "footer.php"; ?>
      </div>
    </div>
	
    <!-- latest jquery-->
    <script src="assets/js/jquery-3.6.0.min.js"></script>
    <!-- Bootstrap js-->
    <script src="assets/js/bootstrap/bootstrap.bundle.min.js"></script>
    <!-- feather icon js-->
    <script src="assets/js/icons/feather-icon/feather.min.js"></script>
    <script src="assets/js/icons/feather-icon/feather-icon.js"></script>
    <!-- scrollbar js-->
    <script src="assets/js/scrollbar/simplebar.js"></script>
    <script src="assets/js/scrollbar/custom.js"></script>
    <!-- Sidebar jquery-->
    <script src="assets/js/config.js"></script>
    <script src="assets/js/sidebar-menu.js"></script>
    <script src="assets/js/datatable/datatables/jquery.dataTables.min.js"></script>
    <script src="assets/js/datatable/datatables/datatable.custom.js"></script>
    <script src="assets/js/tooltip-init.js"></script>
    <!-- Template js-->
    <script src="assets/js/script.js"></script>
    <!-- login js-->
	<script>
	function delRow(e) {
			    var del = confirm("Are you sure want to complete the bookings");
			    if(del){
					//alert(e);
					$.ajax({
						type: 'POST',
						url: "general-functions.php",
						data:{id:e, act: 'UPDATE_BOOK_POST'},
						success: function (data) {
							//alert(data);
							console.log(data);
							alert("Successfully Updated.");
							window.location.href = "booknow.php";							
						}
					});					
			    }
				else {
					alert("Cancelled!");
				}
			}
	</script>
	
	<div id="eventmodal" class="modal fade" role="dialog">
	  <div class="modal-dialog modal-lg">
		
		<!-- Modal content-->
		<div class="modal-content"> 
			<div class="modal-header">
			  <h5 class="modal-title" id="exampleModalLabel-2">Events</h5> 
			  <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
				<span aria-hidden="true">&times;</span>
			  </button>
			</div>
			<div class="modal-body">
			</div>
		  
		</div>
	  </div>
	</div>
	<script>
	  $(document).ready(function(){
	 $('.eventinfo').click(function(){
	   var bid = $(this).data('id');
	   // AJAX request
	   $.ajax({
		url: 'infoevents.php',
		type: 'post',
		data: {bid: bid},
		success: function(response){ 
		  // Add response in Modal body
		  $('.modal-body').html(response);
		  // Display Modal
		  $('#eventmodal').modal('show'); 
		}
	  });
	 });
	});
	</script>
	<script type="text/javascript">
	$(document).ready(function(){
	$('#select_all').on('click',function(){
	if(this.checked){
	$('.checkbox').each(function(){
	this.checked = true;
	});
	}else{
	$('.checkbox').each(function(){
	this.checked = false;
	});
	}
	});
	$('.checkbox').on('click',function(){
	if($('.checkbox:checked').length == $('.checkbox').length){
	$('#select_all').prop('checked',true);
	}else{
	$('#select_all').prop('checked',false);
	}
	});
	});
	</script>
  </body>
</html>

Zerion Mini 1.0