MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 18.223.43.106
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/aircraftelevators.in/../mail/../deergham.com/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/aircraftelevators.in/../mail/../deergham.com/checkout.php
<?php 
    session_start();
    include_once('admin/config.php');

if ($_SERVER["REQUEST_METHOD"] === "POST") {
    if (isset($_POST['submit_btn1'])) {
        $name = $_POST['name'];
        $phone = $_POST['phone'];
        $email = $_POST['email'];
        $state = $_POST['state'];
        $pin = $_POST['pin'];
        $address = $_POST['address'];
        $book_by = $_POST['book_by'];
        $post_by = $_POST['post_by'];
        // $property_name = $_POST['property_name'];
        // $offer_rate = $_POST['product_prices'];
        $offer_rate = isset($_POST['product_prices']) ? implode(',', $_POST['product_prices']) : '';
        $quantities = isset($_POST['product_quantities']) ? implode(',', $_POST['product_quantities']) : '';
        $property_name = isset($_POST['product_names']) ? implode(',', $_POST['product_names']) : '';
        $checkin_date = $_POST['checkin_date'];
        $checkout_date = $_POST['checkout_date'];

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

	      if($result){
                echo "<script>
                    window.location.href = 'https://www.deergham.com/success-cod.php';
                </script>";
                    // window.alert('Successfully Submit Your Query! We will contact you soon');
            } else {
                echo "Error";
            }
        
        }
    }

?>
<!DOCTYPE html>
<html lang=en>
<head>
    <meta charset=UTF-8>
    <meta name=viewport content="width=device-width,initial-scale=1,minimum-scale=1">
    <meta http-equiv=X-UA-Compatible content="ie=edge">
    <title>Cart | Deergham</title>
    <meta name="description" content="Cart | Deergham">
    <?php include "top-links.php" ?>
    <link rel="stylesheet" href="css/customer.min.css">
</head>


<body>
    <?php include "header.php" ?>
   
    <main>
        <header class="page" style="padding-top:;">
        <div class="page_main container-fluid">
            <div class="container">
                <h1 class="page_header">Checkout</h1>
            </div>
        </div>
        <div class="container">
            <ul class="page_breadcrumbs d-flex flex-wrap">
                <li class="page_breadcrumbs-item"><a class="link" href="<?php echo $wspath?>">Home</a></li>
                <li class="page_breadcrumbs-item current"><span>Checkout</span></li>
            </ul>
        </div>
    </header>
        <div class="container ">
            <div class="row">
                <div class="col order-lg-12">
                    <div class="card bg-secondary shadow">
                        <div class="card-header bg-white border-0">
                            <div class="row align-items-center">
                                <div class="col-8">
                                    <h3 class="mb-0">Checkout</h3>
                                </div>
                                <div class="col-4">
                                <a href="cust-logout.php" class="btn" ><strong>Cancel</strong></a>
                                </div>
                            </div>
                        </div>
                        <div class="card-body">
                            <?php
                                $total_quantity = $_REQUEST['total_quantity'];
                                $product_quantities = explode(',', $_REQUEST['product_quantities']);
                                $product_names = explode(', ', $_REQUEST['product_names']);
                                $total_price = $_REQUEST['total_price'];
                                
                                for ($i = 0; $i < count($product_quantities); $i++) {
                                    $quantity = $product_quantities[$i];
                                    $name = $product_names[$i];
                                    echo "Product: $name, Quantity: $quantity <br>";
                                }
                                // foreach ($product_quantities as $key => $quantity) {
                                //     $name = $product_names[$key];
                                //     echo "Product: $name, Quantity: $quantity <br>";
                                // }
                                
                                $cust_email = $_SESSION["user"]["cust_email"];
                                $sql_check = "SELECT * FROM `tbl_customer` WHERE `cust_email` = '$cust_email'";
                                $run_check = mysqli_query($db,$sql_check);
                                $data_check = mysqli_fetch_assoc($run_check);
                                
                            ?>
                            <form method="POST" enctype="multipart/form-data">
                                <?php
                                    foreach ($_SESSION['cart'] as $key => $value) {
                                        echo '<input type="hidden" name="product_names[]" value="' . $value['name'] . '">';
                                        echo '<input type="hidden" name="product_quantities[]" value="' . $value['quantity'] . '">';
                                        echo '<input type="hidden" name="product_prices[]" value="' . $value['price'] . '">';
                                    }
                                ?>
                                <input type="hidden" name="total_price" value="<?php echo $total_price ?>">
                                <h6 class="heading-small text-muted mb-4">Confirm Your Contact information</h6>
                                <div class="pl-lg-4">
                                    <div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group focused">
                                                <label class="form-control-label" for="input-name">Your Name</label>
                                                <input id="input-name" class="form-control form-control-alternative" placeholder="Home Address" value="<?= $data_check['cust_name'] ?>" type="text" name="name" required>
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <div class="form-group focused">
                                                <label class="form-control-label" for="input-address">Your Email</label>
                                                <input class="form-control form-control-alternative" placeholder="Home Address" value="<?= $data_check['cust_email'] ?>" type="email" name="email" required>
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <div class="form-group focused">
                                                <label class="form-control-label" for="input-phone">Your Phone</label>
                                                <input id="input-phone" class="form-control form-control-alternative" placeholder="Phone No." value="<?= $data_check['cust_phone'] ?>" type="text" name="phone" required>
                                            </div>
                                        </div>
                                   
                                        <div class="col-lg-6">
                                            <div class="form-group focused">
                                                <label class="form-control-label" for="input-city">City</label>
                                                <input type="text" class="form-control form-control-alternative" placeholder="City" value="<?= $data_check['city'] ?>" name="city" required>
                                            </div>
                                        </div>
                                        <div class="col-lg-6">
                                            <div class="form-group focused">
                                                <label class="form-control-label" for="input-country">State</label>
                                                <input type="text" class="form-control form-control-alternative" placeholder="State" value="<?= $data_check['state'] ?>" name="state" required>
                                            </div>
                                        </div>
                                        <div class="col-lg-6">
                                            <div class="form-group">
                                                <label class="form-control-label" for="input-postal-code">Postal code</label>
                                                <input type="number" id="input-postal-code" name="pin" class="form-control form-control-alternative" placeholder="Postal code" value = "<?= $data_check['postal_c'] ?>" required>
                                            </div>
                                        </div>
                                        <div class="col-lg-12">
                                            <div class="form-group focused">
                                                <label class="form-control-label" for="address">Local Address</label>
                                                <textarea rows="4" name="address" class="form-control form-control-alternative" placeholder="Your address" required></textarea>
                                            </div>
                                        </div>
                                        <div class="col-12 text-center">
                                            <button type="submit" class="btn" name="submit_btn" formaction="phonepay.php">Pay Now</button>
                                            <button type="submit" class="btn" name="submit_btn1" formaction="<?php $_PHP_SELF ?>">Pay on Delivery</button>
                                        </div>
                                    </div>
                                 </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
         
    </main>
    
   <?php include "footer.php" ?>
   
</body>

</html>

MMCT - 2023