MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 18.191.93.18
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/ppcad7no/digitala2z.com/../deergham.com/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/digitala2z.com/../deergham.com/book.php
<?php 
include_once('admin/config.php');

  if (!isCustomerLoggedIn()) {
		$_SESSION['msg'] = "You must log in first";
		header('location: sign.php');
  }

  if (isset($_GET['logout'])) {
	session_destroy();
	unset($_SESSION['user']);
	header("location: sign.php");
  }

if ($_SERVER["REQUEST_METHOD"] === "POST") {
    if (isset($_POST['submit_btn'])) {
        $name = $_POST['name'];
        $phone = $_POST['phone'];
        $email = $_POST['email'];
        $book_by = $_POST['book_by'];
        $post_by = $_POST['post_by'];
        $property_name = $_POST['property_name'];
        $offer_rate = $_POST['offer_rate'];
        $checkin_date = $_POST['checkin_date'];
        $checkout_date = $_POST['checkout_date'];

        $query = "INSERT INTO `tbl_booking`(`booking_name`, `booking_for`, `contact`, `booking_email`, `booking_rate`, `checkin_date`, `checkout_date`, `payment_status`, `booking_status`, `booking_of`,`book_by`) VALUES ('$name', '$property_name', '$phone', '$email', '$offer_rate', '$checkin_date', '$checkout_date', 'Pending', 'Pending','$post_by','$book_by')";
        $result = mysqli_query($db, $query) or die("Query unsuccessful");

	      if($result){
                echo "<script>
                    window.alert('Successfully Submit Your Query! We will contact you soon');
                    window.location.href = 'thanks.html';
                </script>";
            } else {
                echo "Error";
            }
        
        }
    }

?>
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Booking - Deergham</title>
    
    <?php include 'top-link.php';?> 
    
    <style>
.checkout-page .booking-box input{
    border-radius:3px !important;
    /*padding: 0px !important;*/
    /*font-size: 23px!important;*/
    width:100%;
    font-size: 17px !important;
    padding: 5px !important;
}
.checkout-page .booking-box{
        align-items: center;
    justify-content: center;
    display: flex;
    
    margin:40px 0px;
   
    padding:20px;
}
.checkout-page .booking-box h5{
    color:red;
}
.checkout-page a{
    text-decoration:none;
}
.checkout-page button{
        border: none;
    border-radius: 5px;
    padding: 6px 12px;
    color: white;
    background: red;
    box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
    display:none;
   
}
.error{
           color:red;
       }

</style>
<?php include 'header.php';?>
<section class="checkout-page">
    <div class="container">
        <div class="row">
            <div class="booking-box">
                <div style="box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;border-radius:10px" class="col-md-8   p-4">
                    <!--<a href="<?php echo $wspath?>"><h5 class="home my-3">Home</h5></a>-->
                    <p>We will use these details to share your booking information</p>
                  <form method="POST" action="phonepay.php">
                    <?php
                      $property=$_GET['property_name'];
                      $post_by=$_GET['post_by'];
                      $normal_rate=$_GET['normal_rate'];
                      $rate=$_GET['offer_rate'];
                      $discountPercentage = (($normal_rate - $rate) / $normal_rate) * 100;
                      $discountPercentageFormatted = number_format($discountPercentage, 2); 
                      
                      $user_id = $_SESSION['user']['cus_id'];
                      $sqlpro = "SELECT * FROM `tbl_customer` WHERE cus_id=$user_id";
                      $runpro = mysqli_query($db,$sqlpro) or die("Query Not run");
                      $datapro = mysqli_fetch_assoc($runpro);
                    ?>
                    <div class="row">
                        <div class="col-md-6 my-2">
                            <label for="fname">Property Name</label>
                            <input type="hidden" id="post_by" name="post_by" value="<?php echo $post_by ?>">
                            <input type="hidden" id="book_by" name="book_by" value="<?php echo $user_id ?>">
                            <input type="text" id="fname" name="property_name" value="<?php echo $property ?>" readonly>
                        </div>
                         <div class="col-md-6 my-2">
                            <label for="lname">Your name:</label>
                            <input type="text" id="name" name="name" value="<?php echo $datapro['cust_name']; ?>">
                            <?php if (isset($errors) && in_array("Name field is required.", $errors)) { ?>
                                <p class="error">Name field is required.</p>
                            <?php } elseif (isset($errors) && in_array("Name can only contain alphabets.", $errors)) { ?>
                                <p class="error">Name can only contain alphabets.</p>
                            <?php } ?>
                        </div>
                         <div class="col-md-6 my-2">
                            <label for="tel">Contact No.:</label> <br> 
                            <input type="tel" id="contact" name="phone" minlength="10" maxlength="10" onkeypress="return isNumberKey(event)" pattern=".{10,10}" required value="<?php echo $datapro['cust_phone']; ?>">
                            <?php if (isset($errors) && in_array("Phone field is required.", $errors)) { ?>
                                <p class="error">Phone field is required.</p>
                            <?php } elseif (isset($errors) && in_array("Phone number should have exactly 10 digits.", $errors)) { ?>
                                <p class="error">Phone number should have exactly 10 digits.</p>
                            <?php } ?>
                        </div>
                          <div class="col-md-6 my-2">
                            <label for="tel">Email:</label><br>
                            <input type="email" id="email" name="email" value="<?php echo $datapro['cust_email']; ?>">
                            <?php if (isset($errors) && in_array("Email field is required.", $errors)) { ?>
                                <p class="error">Email field is required.</p>
                            <?php } ?>
                        </div>
                         <div class="col-md-6 my-2">
                            <label for="indate">Checkin Date:</label><br>
                            <input type="date" id="indate" name="checkin_date" required>
                        </div>
                         <div class="col-md-6 my-2">
                            <label for="outdate">Checkout Date:</label><br>
                            <input type="date" id="outdate" name="checkout_date" required>
                        </div>
                        <div style="display: flex;" class="col-md-6 my-4">
                            <h1 class="mx-3" style="color:red" >₹<span><?php echo $rate ?></span></h1>
                            <input type="hidden" name="offer_rate" value="<?php echo $rate ?>">
                            <p class="mx-3" style="text-decoration: line-through"><?php echo $normal_rate ?></p>
                            
                        </div>
                         <div style="display:flex" class="col-md-6 my-2">
                            <input Style="width: 18px;margin: 0px 11px;margin-bottom: 11px;"type="checkbox" id="myCheck" onclick="myFunction()">
                            <p for="myCheck" style="padding-top: 10px;" >I accepted all <a href="terms-conditions.php">Terms & Conditions</a></p>
                            
                        </div>
                        <div  style=" justify-content: center;align-items: center;display: flex;" class="col my-2">
                            <button id="text" type="submit" name="submit_btn">Proceed to Payment</button>
                        </div>
                    </div> 
                  </form>
                </div>
            </div>
        </div>
    </div>
</section>
<script>
function myFunction() {
  var checkBox = document.getElementById("myCheck");
  var text = document.getElementById("text");
  if (checkBox.checked == true){
    text.style.display = "block";
  } else {
     text.style.display = "none";
  }
}
</script>
<?php include 'footer.php';?>

MMCT - 2023