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/bond-lounge.com/public_html/admin9120/ |
<?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
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,$shipping_fee,$payment_method);
$numrows = $stmt -> num_rows();
if($numrows > 0){
while ($stmt -> fetch()) {
if($status=="Pending"){$status_color="red";}
if($status=="Completed"){$status_color="forestgreen";}
}
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index2.php\">";exit();}
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index3.php\">";exit();}
//get the users details for the email sending and to display to the merchant
$stmt_users = $con -> prepare('SELECT * FROM users WHERE user_id=?');
$stmt_users -> bind_param('s',$user_id);
$stmt_users -> execute();
$stmt_users -> store_result();
$stmt_users -> bind_result($id,$user_id,$first_name,$last_name,$email,$password,$phone,$address,$date_signed_up);
$numrows_users = $stmt_users -> num_rows();
while ($stmt_users -> fetch()) {}
?>
<title><?php echo $company_name; ?>, Admin, Order no <?php echo $order_id; ?></title>
<?php
if (isset($_POST["mark_as_completed"])) {
$completed="Completed";
$stmt_com = $con -> prepare('UPDATE my_orders SET status = ? WHERE order_id = ?');
$stmt_com -> bind_param('ss', $completed,$order_id);
$stmt_com -> execute();
//send email to client that the order was completed
$msg = '';
$subject = "$first_name Order $order_id was successfully completed";
$message="";
$button_link="$link/sign_in.php";
$button_text="Log in";
$email_topic="Order Verified!";
include("email_header.php");
$message .= "
Dear $first_name,<br/><br/>
Thank you for your order.Your payment has been received. Your goods will be delivered in the time and manner as discussed with our representative.<br/>If you have any questions please contact our dedicated support staff at $company_email<br/><br/>
The $company_name Team.<br/><br/>
$email_logo<br/><br/>
";
include("email_footer.php");
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 = "$email_noreply"; // SMTP account username
$mail->Password = "$email_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 = "Email NOT sent.";
}
else {
$msg = "Email successfully sent.";
}
//create a session to verify it's coming from here
$_SESSION["action"] = "true";
$message="Order was successfully marked as completed. $msg";
echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=$page_name?order_id=$order_id&m=$message\">";
}
if (isset($_POST["mark_as_pending"])) {
$pending="Pending";
$stmt = $con -> prepare('UPDATE my_orders SET status = ? WHERE order_id = ?');
$stmt -> bind_param('ss', $pending,$order_id);
$stmt -> execute();
//create a session to verify it's coming from here
$_SESSION["action"] = "true";
$message="Order was successfully marked as pending.";
echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=$page_name?order_id=$order_id&m=$message\">";
}
if (isset($_POST["delete"])) {
$stmt = $con -> prepare('DELETE FROM my_orders WHERE order_id = ?');
$stmt -> bind_param('s', $order_id);
$stmt -> execute();
$stmth = $con -> prepare('DELETE FROM cart_details WHERE order_id = ?');
$stmth -> bind_param('s', $order_id);
$stmth -> execute();
//create a session to verify it's coming from here
$_SESSION["action"] = "true";
$message="Order successfully deleted.";
echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=pending_orders.php&m=$message\">";
}
?>
<!-- ======= Breadcrumbs ======= -->
<section id="breadcrumbs" class="breadcrumbs">
<div class="container"> </div>
</section>
<!-- End Breadcrumbs -->
<!-- ======= Contact Section ======= -->
<section id="contact" class="contact inner-page">
<div class="container" data-aos="fade-up">
<div class="section-title">
<h2>Order NO:<?php echo $order_id; ?></h2>
<p></p>
</div>
<div class="row">
<div class="col-lg-12">
<div class='row'>
<?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"
<div class='col-2'>
<a href='../product_details.php?u=$product_id'>
<img src='../site_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/>
</div>"
;
$total = $qty * $product_price;
$total_array[] = $total;
}
echo"
</div>
Client <span style='font-weight:900;'><a href='user_details.php?u=$user_id'>$first_name $last_name</a></span><br/>
Email <span class='number_box'>$email</span><br/>
Phone <span class='number_box'>$phone</span><br/>
Status <span class='number_box' style='color:$status_color;'>$status</span><br/>";
$grand_total = array_sum($total_array);
$gt = $grand_total;
echo"
Subtotal<span class='number_box'>$currency";echo number_format($grand_total);echo"</span><br/>
Total <span class='number_box the_color'>$currency";echo number_format($gt);echo"
</span>";
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=index5.php\">";exit();}
?>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?><?php echo"?order_id=$order_id"; ?>" method="post" class="php-email-form1" enctype='multipart/form-data'>
<?php
if($status=="Pending"){
echo"
<div class='text-center'>
<button type='submit' name='mark_as_completed'>Mark as Completed</button>
<button type='submit' name='delete'>Delete</button>
<a class='btn btn-primary' href='user_details.php?u=$user_id'>Back</a>
</div>
";
}
if($status=="Completed"){
echo"
<div class='text-center'>
<button type='submit' name='mark_as_pending'>Mark as Pending</button>
<button type='submit' name='delete'>Delete</button>
<a class='btn btn-primary' href='user_details.php?u=$user_id'>Back</a>
</div>
";
}
?>
</form>
</div>
</div><!-- end row -->
</div>
</section><!-- End Contact Section -->
<?php include("footer.php"); ?>