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/soniahjeweler.com/public_html/admin509/ |
<?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 orders WHERE order_id=?');
$stmt -> bind_param('s',$order_id);
$stmt -> execute();
$stmt -> store_result();
$stmt -> bind_result($id,$order_id,$first_name,$last_name,$email,$phone,$message,$date,$currency,$product_price,$product_name,$status);
$numrows = $stmt -> num_rows();
if($numrows > 0){
while ($stmt -> fetch()) {
//get user id from users table
$stmt_user = $con -> prepare('SELECT user_id FROM users WHERE email=?');
$stmt_user -> bind_param('s',$email);
$stmt_user -> execute();
$stmt_user -> store_result();
$stmt_user -> bind_result($user_id);
$stmt_user -> fetch();
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; ?>, Admin, Order no <?php echo $order_id; ?></title>
<?php
if (isset($_POST["mark_as_completed"])) {
$completed="Completed";
$stmt_com = $con -> prepare('UPDATE 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 = "smtp.titan.email"; // sets the SMTP server
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Set encryption to STARTTLS
$mail->Port = 587; // Use port 587 for TLS
$mail->Username = "$no_reply_email"; // SMTP account username
$mail->Password = "$no_reply_password"; // SMTP account password
$mail->SetFrom("$no_reply_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 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 orders WHERE order_id = ?');
$stmt -> bind_param('s', $order_id);
$stmt -> 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=orders.php&m=$message\">";
exit();
}
?>
<!-- ======= 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-8">
<h2>ORDER DETAILS</h2>
<?php
echo"
Customer: <span class='' style='font-weight:900;'><a href='user_details.php?u=$user_id'>$first_name $last_name</a></span><br/>
Email: <span style='font-weight:900;'>$email</span><br/>
Phone: <span style='font-weight:900;'>$phone</span><br/>
Item: <span style='font-weight:900;'>$product_name</span><br/>
Payment: <span class='number_bo' style='color:$status_color;font-weight:900;'>$status</span><br/>
Comments: <span style='font-weight:900;'>$message</span><br/>
Amount: <span style='font-weight:900;'>$currency $product_price</span><br/>
Date: <span style='font-weight:900;'>";echo "$date"; echo"</span><hr/>
";
?>
<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>
</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>
</div>
";
}
?>
</form> <br><br>
</div>
</div><!-- end row -->
</div>
</section><!-- End Contact Section -->
<?php include("footer.php"); ?>