Server : LiteSpeed System : Linux us-phx-web1202.main-hosting.eu 4.18.0-553.84.1.lve.el8.x86_64 #1 SMP Tue Nov 25 18:33:03 UTC 2025 x86_64 User : u615232177 ( 615232177) PHP Version : 8.1.33 Disable Function : NONE Directory : /home/u615232177/domains/poiseseat.com/public_html/ |
<?php use PHPMailer\PHPMailer\PHPMailer;use PHPMailer\PHPMailer\Exception;use PHPMailer\PHPMailer\SMTP; session_start();
$page_name = basename($_SERVER['PHP_SELF']);
include("headerstrict.php"); ?>
<?php
//details passed from previous page
$last_name = $_SESSION["last_name"];
$phone = $_SESSION["phone"];
$comments = $_SESSION["comments"];
$payment_method = $_SESSION["payment_method"];
if (isset($_GET['order_id'])){
$order_id = mysqli_real_escape_string($con,$_GET['order_id']);
$stmt = $con -> prepare('SELECT * FROM my_orders WHERE order_id=?');
$stmt -> bind_param('s',$order_id);
$stmt -> execute();
$stmt -> store_result();
$stmt -> bind_result($id,$user_id_db,$order_id,$total,$nice_date,$horrible_date,$status,$email_succesful,$email_delivered,$delivery_zone_complete,$payment_method);
$numrows = $stmt -> num_rows();
//status coloring
if($numrows > 0){
while ($stmt -> fetch()) {
$divided = explode('-',$delivery_zone_complete,2);
$delivery_zone_id = $divided[0];
$delivery_zone_fee = $divided[1];
if($status=="Pending"){$status_color="red";}
if($status=="Completed"){$status_color="forestgreen";}
}
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";exit();}
//only owner can view
if($user_id == $user_id_db){
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";exit();}
//convert to kobo for paystack
$gt = $total + $delivery_zone_fee;
function to_kobo($value)
{
return intval(
strval(floatval(
preg_replace("/[^0-9.]/", "", $value)
) * 100)
);
}
$amount_in_kobo = to_kobo("$gt");
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";exit();}
?>
<?php
if (isset($_POST['bank_transfer'])){
//send the emails to both customer and merchant
$msg = '';
$subject = "Order No $order_id";
$message="";
$message .= "
Hello Admin,<br/><br/>
Name - $first_name $last_name<br/>
Email - $email<br/>
Phone - $phone<br/>
Comments - $comments<br/>
Payment Method - $payment_method<br/>
Details of order <b style='color:cornflowerblue;'>$order_id</b><br/>";
$che = mysqli_query($con,"SELECT * FROM cart_details WHERE order_id='$order_id'");
if (mysqli_num_rows($che) > 0) {
while ($get = mysqli_fetch_array($che)) {
$product_id = $get["product_id"];
$product_title = $get["product_title"];
$product_image = $get["product_image"];
$product_price = $get["product_price"];
$qty = $get["qty"];
$message .="
<img src='$link/admin$admin_no/assets/img/products/$product_image' alt='$product_title' style='width:70px;height:70px;'>
<h5 style='font-weight:700;font-size:14px;line-height:1px;'>$product_title</h5>
<p style='font-size:10px;line-height:1px;'>$currency$product_price.00</p>
<p style='font-size:10px;line-height:1px;'>Quantity - $qty</p>
<div style='color:gainsboro;opacity:0.5;'><hr/></div>
";
}
}
$message .="
<span style='font-weight:900;'>$currency$delivery_zone_fee.00</span> - Shipping Fee<br/>
<span style='font-weight:900;'>$currency$total.00</span> - Total<br/><br/>
To attend to this order click <a href='$link/$admin_no/orders_pending.php'>here</a>
";
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
require 'PHPMailer/src/Exception.php';
$mail = new PHPMailer();
//$mail->IsSMTP(); // telling the class to use SMTP
//$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "localhost"; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "$no_reply_email"; // SMTP account username
$mail->Password = "$no_reply_password"; // SMTP account password
$mail->SetFrom("$company_email", "$company_name");//Use a fixed address in your own domain as the from address
$mail->AddReplyTo("$company_email", "$company_name"); //Put the submitter's address in a reply-to header
$mail->Subject = "$subject";
$mail->MsgHTML("<html><body>$message<br></body></html>");
$mail->AddAddress("$company_email", "$company_name");//Send the message to yourself, or whoever should receive contact for submissions
//$mail->AddAttachment(""); // attachment
if(!$mail->Send()) {
//echo "Mailer Error: " . $mail->ErrorInfo;
$msg = "<div class='alert alert-danger'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
<b>Something went wrong, please try again</b>
$mail->ErrorInfo
</div>";
}
else {
$msg = "<div class='alert alert-success'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
<b>Email Sent</b>
</div>";
}
$mail->clearAddresses();
$mail->clearReplyTos();
unset($message);
$msg = '';
$subject = "$first_name thank you for your order $order_id";
$message="";
$button_link="$link/sign_in.php";
$button_text="Log in";
$email_topic="Your order has been made.";
include("email_header.php");
$message .= "
Dear $first_name,<br/><br/>
Thank you for shopping up with us at $company_name.Your order is now being processed. We will contact you shortly to confirm your order.<br/>If you have any questions please contact our dedicated support staff at $company_email<br/><br/>
The $company_name Team.<br/><br/>
Please find the details of your order below:<br/>";
$che = mysqli_query($con,"SELECT * FROM cart_details WHERE order_id='$order_id'");
if (mysqli_num_rows($che) > 0) {
while ($get = mysqli_fetch_array($che)) {
$product_id = $get["product_id"];
$product_title = $get["product_title"];
$product_image = $get["product_image"];
$product_price = $get["product_price"];
$qty = $get["qty"];
$message .="
<img src='$link/$admin_no/assets/img/products/$product_image' alt='$product_title' style='width:70px;height:70px;'>
<h5 style='font-weight:700;font-size:14px;line-height:1px;'>$product_title</h5>
<p style='font-size:10px;line-height:1px;'>$currency$product_price.00</p>
<p style='font-size:10px;line-height:1px;'>Quantity - $qty</p>
<div style='color:gainsboro;opacity:0.5;'><hr/></div>
";
}
}
$message.="$email_logo<br/><br/>
";
include("email_footer.php");
//$mail->IsSMTP(); // telling the class to use SMTP
//$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "localhost"; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "$no_reply_email"; // SMTP account username
$mail->Password = "$no_reply_password"; // SMTP account password
$mail->SetFrom("$company_email", "$company_name");//Use a fixed address in your own domain as the from address
$mail->AddReplyTo("$company_email", "$company_name"); //Put the submitter's address in a reply-to header
$mail->Subject = "$subject";
$mail->MsgHTML("<html><body>$message<br></body></html>");
$mail->AddAddress("$email", "$email");//Send the message to yourself, or whoever should receive contact for submissions
//$mail->AddAttachment(""); // attachment
if(!$mail->Send()) {
//echo "Mailer Error: " . $mail->ErrorInfo;
$msg = "<div class='alert alert-danger'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
<b>Something went wrong, please try again</b>
$mail->ErrorInfo
</div>";
}
else {
$msg = "<div class='alert alert-success'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
<b>Email Sent</b>
</div>";
}
//create a session to verify it's coming from here
$_SESSION["action"] = "true";
$message="Your order has been successfully made. We will contact you shortly to confirm your order. Thanks for shopping at $company_name";
echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=your_account.php&m=$message\">";
exit();
}
?>
<title><?php echo $company_name; ?> - Order no <?php echo $order_id; ?></title>
<!-- Title Page -->
<section class="bg-title-page p-t-40 p-b-50 flex-col-c-m" style="background-image: url(images/banner-min.jpg);">
<h2 class="l-text2 t-center">
<div class='space_top'></div>
Order No: <?php echo $order_id; ?>
</h2>
</section>
<br/>
<section class="team spad" style='background:white;'>
<div class="container">
<div class="row">
<div class="col-lg-6">
<div class="billing">
<div class="checkout_title">Order Details</div><br/>
<?php
$stmt1 = $con -> prepare('SELECT * FROM cart_details WHERE order_id=?');
$stmt1 -> bind_param('s',$order_id);
$stmt1 -> execute();
$stmt1 -> store_result();
$stmt1 -> bind_result($id,$order_id,$product_id,$product_title,$product_price,$product_image,$qty);
$numrows1 = $stmt1 -> num_rows();
if($numrows1 > 0){
while ($stmt1 -> fetch()) {
echo"
<a href='product_details.php?u=$product_id'>
<img src='$admin_no/assets/img/products/$product_image' alt='' style='width:100px;height:100px;border-radius:5px;'><br/>
<b>$product_title</b></a><br/>$currency";
echo number_format($product_price);
echo
"
<br/>Qty - $qty<hr/>";
$total = $qty * $product_price;
$total_array[] = $total;
}
echo"Status <span class='number_box' style='color:$status_color;'>$status</span><br/>";
$grand_total = array_sum($total_array);
$gt = $grand_total + $delivery_zone_fee;
echo"
Subtotal<span class='number_box'>$currency";echo number_format($grand_total);echo"</span><br/>
Shipping Fee<span class='number_box'>$currency";echo number_format($delivery_zone_fee);echo"</span><hr/>
Total <span class='number_box the_color'>$currency";echo number_format($gt);echo"
</span>";
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";exit();}
?>
</div><br/><br/>
</div>
<div class="col-lg-6">
<div class="billing">
<div class="checkout_title">Bank Transfer</div><br/>
Kindly make a payment of <?php echo $currency; echo number_format($gt); ?> to <br/>
<b><?php echo"$bank_name - $bank_account"; ?><?php echo " $direct" ?></b>
<form method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?><?php echo"?order_id=$order_id" ?>" class="php-email-form1">
<br/><br/>
<div class="w-size25"style='text-align:;'>
<!-- Button -->
<button type='submit' name='bank_transfer' class="flex-c-m size bg1 redbackground m-text3 trans-0-4" style='text-align:center;width:330px;padding:10px;border-radius:5px;'>
I have done the transfer
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
<?php include("footer.php"); ?>