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/public_html/ |
<?php session_start();
$page_name = basename($_SERVER['PHP_SELF']);
include("headerstrict.php"); ?>
<?php
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,$order_id,$total,$nice_date,$horrible_date,$status,$email_succesful,$email_delivered,$delivery_zone_complete,$payment_method);
$numrows = $stmt -> num_rows();
if($numrows > 0){
while ($stmt -> fetch()) {
$first_order_percentage_sp = 10;
$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();}
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";exit();}
?>
<title><?php echo $company_name; ?> - Order no <?php echo $order_id; ?></title>
<!-- Start All Title Box -->
<div class="all-title-box">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>ORDER ID: <?php echo $order_id ?></h2>
<ul class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active"><?php echo $order_id ?></li>
</ul>
</div>
</div>
</div>
</div>
<!-- End All Title Box -->
<?php
if (isset($_POST['save_changes'])){
$phone = mysqli_real_escape_string($con,$_POST['phone']);
$address = mysqli_real_escape_string($con,$_POST['address']);
$stmt = $con -> prepare('UPDATE users SET phone = ?,address = ? WHERE user_id = ?');
$stmt -> bind_param('sss', $phone,$address,$user_id);
$stmt -> execute();
//create a session to verify it's coming from here
$_SESSION["action"] = "true";
$message="Update was successfully done.";
echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=$page_name&m=$message\">";
}
?>
<div class="checkout">
<div class="container">
<div class="row">
<div class="col-lg-6">
<div class="billing"><br/><br/>
<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"
<div style='font-size:20px;position:relative;top:5px;'>DELIVERY STATUS:<span style='font-weight:900;'> $horrible_date</span></div><br/>
<div class='lineo'></div>
Payment <span class='number_box_order' style='color:$status_color;'>$status</span><br/>";
$grand_total = array_sum($total_array);
//is this the first order?
$one=1; $first_order = "false"; $first_order_off=0;
$stmt40 = $con -> prepare('SELECT order_id FROM my_orders WHERE user_id = ? ORDER BY id ASC LIMIT ?');
$stmt40 -> bind_param('si',$user_id,$one);
$stmt40 -> execute();
$stmt40 -> store_result();
$stmt40 -> bind_result($first_order_id);
$numrows40 = $stmt40 -> num_rows();
if($numrows40 > 0){
while ($stmt40 -> fetch()) {
if($first_order_id == $order_id){
$first_order = "true";
$percentInDecimal = $first_order_percentage_sp / 100;
$first_order_off = $percentInDecimal * $grand_total;
}
}
}
//calculate bank charges
//$percentInDecimal = $percent_off / 100;
//$bank_charges = $percentInDecimal * $grand_total;
$bank_charges = 0;
//grand total
$gt = $grand_total + $delivery_zone_fee + $bank_charges - $first_order_off;
echo"
Subtotal<span class='number_box_order'>$currency";echo number_format($grand_total);echo"</span><br/>
Shipping Fee<span class='number_box_order'>$currency";echo number_format($delivery_zone_fee);echo"</span><br>
Bank Charges<span class='number_box_order'>$currency";echo number_format($bank_charges);echo"</span><br>";
if($first_order == "true"){
echo "$first_order_percentage_sp% off first order<span class='number_box_order' style='color:forestgreen;'>-$currency";echo number_format($first_order_off);echo"</span>";
}
echo"<div class='lineo'></div>";
echo"Total <span class='number_box_order the_color'>$currency";echo number_format($gt);echo"</span>";
echo"<div class='lineo'></div>";
echo"<br/><br/>";
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";exit();}
//if the order is pending, give them an opportunity to pay for it
if($payment_method == "Bank Transfer Opay"){$bank = "opay";}
if($payment_method == "Bank Transfer Moniepoint"){$bank = "moniepoint";}
if($status=="Pending"){
echo"<a class='btn hvr-hover' style='color:white;' href='order_payment_$bank.php?order_id=$order_id'>Pay</a> <br> <br>";
}
?>
</div>
</div>
<div class="col-lg-6">
<div class="billing"><br/><br/>
<?php $add_status_color = "black";
$stmt_add = $con -> prepare('SELECT * FROM additional_funds WHERE order_id = ?');
$stmt_add -> bind_param('s',$order_id);
$stmt_add -> execute();
$stmt_add -> store_result();
$stmt_add -> bind_result($add_id,$order_id,$amount_requested,$add_status,$date_requested,$date_accepted,$add_payment_method);
$numrows_add = $stmt_add -> num_rows();
if($numrows_add > 0){
echo"
<div class='checkout_title' style='line-height:30px;'>ADDITIONAL FUNDS REQUEST</div><br>
";
while ($stmt_add -> fetch()) {
if($add_status == "Completed"){
$add_status_color ="forestgreen";
}
if($add_status == "Pending"){
$add_status_color ="crimson";
}
//format the date
$date_requested1=date_create("$date_requested");
$date_requested_format = date_format($date_requested1,"D, dS M, Y g:ia");
if($date_accepted !== ""){
$date_accepted1=date_create("$date_accepted");
$date_accepted_format = date_format($date_accepted1,"D, dS M, Y g:ia");
}
?>
<?php echo "Amount Requested: <b>$currency"; echo number_format($amount_requested); echo"</b>";?> <br>
Status: <b style='color:<?php echo $add_status_color; ?>;'><?php echo $add_status; ?></b><br>
Date Requested: <b><?php echo $date_requested_format; ?></b><br>
<?php if($add_status == "Completed"){ ?>
Date Accepted: <b><?php echo $date_accepted_format; ?></b><br>
<?php } ?>
<?php if($add_status !== "Completed"){
if($add_payment_method == ""){
?>
<a class="btn hvr-hover" style='color:white;' href="order_payment_additional.php?order_id=<?php echo $order_id; ?>&add_id=<?php echo $add_id; ?>">Pay</a>
<?php }} ?>
<hr>
<?php
}
}
?>
</div>
</div>
</div>
</div>
</div>
<?php include("footer.php"); ?>