One Hat Cyber Team
Your IP :
216.73.216.186
Server IP :
147.79.69.155
Server :
Linux in-mum-web1837.main-hosting.eu 5.14.0-503.34.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 27 06:00:50 EDT 2025 x86_64
Server Software :
LiteSpeed
PHP Version :
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
u322583024
/
domains
/
loveberi.com
/
public_html
/
View File Name :
payment-success.php
<?php require('connection.inc.php'); require('security.php'); $order_id = $_GET['order_id'] ?? ''; $payment_id = $_GET['payment_id'] ?? ''; $status = $_GET['payment_status'] ?? ''; if ($order_id && $payment_id && $status === 'Credit') { $payment_datetime = date('Y-m-d H:i:s'); // Indian time $stmt = $conn->prepare("UPDATE orders SET payment_id = ?, payment_status = 'Paid', payment_datetime = ? WHERE order_id = ?"); $stmt->bind_param("sss", $payment_id, $payment_datetime, $order_id); $stmt->execute(); $stmt->close(); // Fetch user details for email $stmt = $conn->prepare("SELECT first_name, last_name, email, cart.user_id FROM cart JOIN users ON cart.user_id = users.user_id WHERE cart.user_id = ?"); $stmt->bind_param("i", $user_id); $stmt->execute(); $stmt->bind_result($first_name, $last_name, $email, $user_id); $stmt->fetch(); $stmt->close(); // Delete cart for this user $stmt = $conn->prepare("DELETE FROM cart WHERE user_id = ?"); $stmt->bind_param("i", $user_id); $stmt->execute(); $stmt->close(); // Send confirmation email $subject = "Order Confirmation - $order_id"; $logo_url = 'https://loveberi.com/assets/img/allnew/logo.png'; // Replace with actual logo URL $order_link = "https://loveberi.com/orderconfirm.php?order_id=$order_id"; $message = " <html> <head> <title>Order Confirmation - $order_id</title> </head> <body> <div style='font-family: Arial, sans-serif; color: #333;'> <img src='$logo_url' alt='Loveberi Logo' style='height: 60px;'><br><br> <h2>Thank you for your order!</h2> <p>Your order <strong>$order_id</strong> has been confirmed.</p> <p><strong>Order Summary:</strong></p> <ul> <li>Total Amount: ₹" . number_format($cartSubtotal, 2) . "</li> <li>Payment ID: $payment_id</li> </ul> <p>You can view your order details at the link below:</p> <p><a href='$order_link' style='color: #4CAF50;'>View Order Details</a></p> <br> <p>Regards,<br>Loveberi Team</p> </div> </body> </html>"; // Set headers for HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $headers .= 'From: no-reply@loveberi.com' . "\r\n"; // Send the email if (mail($email, $subject, $message, $headers)) { header("Location: orderconfirm.php?order_id=$order_id"); exit; } else { echo " <script src='https://cdn.jsdelivr.net/npm/sweetalert2@11'></script> <script> document.addEventListener('DOMContentLoaded', function() { Swal.fire({ icon: 'error', title: 'Payment Failed', text: 'There was an issue sending the confirmation email. Please try again later.', confirmButtonText: 'OK' }).then(() => { window.location.href = 'index.php'; }); }); </script> "; } } else { echo " <script src='https://cdn.jsdelivr.net/npm/sweetalert2@11'></script> <script> document.addEventListener('DOMContentLoaded', function() { Swal.fire({ icon: 'error', title: 'Payment Failed', text: 'Your payment was cancelled or failed. You will be redirected to the homepage.', confirmButtonText: 'OK' }).then(() => { window.location.href = 'index.php'; // Redirect to index page }); }); </script> "; } ?>