<?php

include "classes/class.loader.php";
?>
<style>
    body {
        background-color: black;
    }
</style>
<div id="overlay"
    style="display:block;position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,0.5);z-index:9999;">
    <div style="position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center;">
        <!-- <img src="images/loader.gif" alt="loading..." style="width:50px;height:50px;" /> -->
        <p style="color:white;font-size:1.5em;">Loading...</p>
    </div>
</div>
<?php
$db = new db();
$db->query("UPDATE bookings SET status = 3 WHERE record_id = '" . $_POST['booking_id'] . "'");
$db->query("DELETE FROM `visit_trans` WHERE `booking_id` = {$_POST['booking_id']}");
$db->query("DELETE FROM `payments` WHERE `booking_id` = {$_POST['booking_id']}");

$email = new email();
$email->add_address($_SESSION['email'], $_SESSION['username']);
$email->add_address("walruslector@gamil.com", "Jana");
$email->add_address("unleashed.offleashed@gamil.com", "Rika");
$email->subject("Unleashed - Booking Canceled");
$email->body("<html>
            <head>
                <style>
                    body { font-family: Arial, sans-serif; }
                    h1 { color: #333; }
                    p { color: #555; }
                </style>
            </head>
            <body>
                <h1>Credits Added Successfully</h1>
                <p>Dear Customer,</p>
                <p>Your booking has been canceled.</p>
                <p>If you have any questions, feel free to contact our support team.</p>
                <p>Best regards,</p>
                <p>The Unleashed Team</p>
            </body>
        </html>");
// $email->send();

echo "<script>window.location = 'home.php';</script>";