MMCT TEAM
Server IP : 217.21.85.138  /  Your IP : 216.73.216.103
Web Server : LiteSpeed
System : Linux in-mum-web906.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64
User : u915722082 ( 915722082)
PHP Version : 7.4.33
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u915722082/.nvm/../public_html/lohri/user/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u915722082/.nvm/../public_html/lohri/user/order_success.php
<!-- order_success.php -->

<?php
session_start();
require_once __DIR__ . '/../config/config.php';
require_once __DIR__ . '/../vendor/autoload.php'; // PHPMailer
use PHPMailer\PHPMailer\PHPMailer;

if (!isset($_SESSION['user_id'])) {
    header("Location: login.php");
    exit();
}

$order_number = $_GET['order'] ?? '';

$pdo = new PDO(
    "mysql:host=" . DB_HOST . ";dbname=" . DB_NAME . ";charset=utf8mb4",
    DB_USER, DB_PASS,
    [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]
);

$orderStmt = $pdo->prepare("
    SELECT o.*, osh.* 
    FROM orders o
    LEFT JOIN order_shipping_details osh ON o.order_id = osh.order_id
    WHERE o.order_number = ? AND o.user_id = ?
");
$orderStmt->execute([$order_number, $_SESSION['user_id']]);
$order = $orderStmt->fetch();

if (!$order) {
    header("Location: orders.php");
    exit();
}

/* ================== SEND CONFIRMATION EMAIL ================== */
try {
    $userStmt = $pdo->prepare("SELECT email, username FROM tbl_user WHERE uid = ?");
    $userStmt->execute([$_SESSION['user_id']]);
    $user = $userStmt->fetch();

    if ($user && !empty($user['email'])) {
        $mail = new PHPMailer(true);
        $mail->isSMTP();
        $mail->Host       = SMTP_HOST;
        $mail->SMTPAuth   = true;
        $mail->Username   = SMTP_USERNAME;
        $mail->Password   = SMTP_PASSWORD;
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // or ENCRYPTION_SMTPS if using port 465
        $mail->Port       = SMTP_PORT;

        $mail->setFrom(SMTP_FROM_EMAIL, SMTP_FROM_NAME);
        $mail->addAddress($user['email'], $user['username'] ?? '');

        $mail->isHTML(true);
        $mail->Subject = "Order Confirmation - " . $order['order_number'];
        $mail->Body = "
            <h2>Thank you for your order!</h2>
            <p><strong>Order Number:</strong> {$order['order_number']}</p>
            <p><strong>Total Amount:</strong> ₹" . number_format($order['total_amount'], 2) . "</p>
            <p><strong>Payment Method:</strong> " . strtoupper($order['payment_method']) . "</p>
            <p>We’ll notify you when your order is shipped.</p>
        ";
        $mail->AltBody = "Order {$order['order_number']} placed. Total ₹{$order['total_amount']}.";

        $mail->send();
    }
} catch (Exception $e) {
    error_log("Order success email failed: " . $e->getMessage());
}
/* ================== END EMAIL ================== */
?>
<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Order Placed Successfully</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="../css/style.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    
    <?php include "../user/header.php" ?>
    
    <style>
        /* Reset and Base Styles */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            overflow-x: hidden;
            width: 100%;
        }

        /* Success Page Container */
        .success-page-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 50px 30px 100px;
            min-height: 60vh;
        }

        /* Success Animation */
        .success-animation {
            margin: 30px auto;
            width: 100px;
            height: 100px;
        }

        .checkmark {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            display: block;
            stroke-width: 2;
            stroke: #4bb71b;
            stroke-miterlimit: 10;
            box-shadow: inset 0px 0px 0px #4bb71b;
            animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
            position: relative;
            margin: 0 auto;
        }

        .checkmark__circle {
            stroke-dasharray: 166;
            stroke-dashoffset: 166;
            stroke-width: 2;
            stroke-miterlimit: 10;
            stroke: #4bb71b;
            fill: #fff;
            animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
        }

        .checkmark__check {
            transform-origin: 50% 50%;
            stroke-dasharray: 48;
            stroke-dashoffset: 48;
            animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
        }

        @keyframes stroke {
            100% { stroke-dashoffset: 0; }
        }

        @keyframes scale {
            0%, 100% { transform: none; }
            50% { transform: scale3d(1.1, 1.1, 1); }
        }

        @keyframes fill {
            100% { box-shadow: inset 0px 0px 0px 30px #4bb71b; }
        }

        /* Content Styles */
        .success-content {
            text-align: center;
            max-width: 600px;
            margin: 0 auto;
        }

        .success-title {
            font-size: 32px;
            font-weight: 600;
            margin: 30px 0 15px;
            color: #000;
        }

        .success-subtitle {
            font-size: 18px;
            color: #666;
            margin-bottom: 30px;
        }

        /* Order Details Card */
        .order-details-card {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 25px;
            margin: 30px 0;
            border: 1px solid #e5e5e5;
        }

        .order-details-title {
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 20px;
            color: #000;
        }

        .order-info-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 0;
            border-bottom: 1px solid #e5e5e5;
        }

        .order-info-row:last-child {
            border-bottom: none;
        }

        .order-info-label {
            font-weight: 500;
            color: #666;
            font-size: 15px;
        }

        .order-info-value {
            font-weight: 600;
            color: #000;
            font-size: 15px;
        }

        /* Buttons */
        .button-group {
            display: flex;
            flex-direction: column;
            gap: 12px;
            max-width: 400px;
            margin: 30px auto 0;
        }

        .btn-view-order,
        .btn-continue {
            padding: 15px 30px;
            font-size: 15px;
            font-weight: 500;
            border-radius: 4px;
            text-decoration: none;
            text-align: center;
            transition: all 0.3s ease;
            border: none;
            cursor: pointer;
            display: block;
            width: 100%;
        }

        .btn-view-order {
            background: #000;
            color: #fff;
        }

        .btn-view-order:hover {
            background: #333;
            color: #fff;
        }

        .btn-continue {
            background: transparent;
            color: #000;
            border: 1px solid #000;
        }

        .btn-continue:hover {
            background: #f2f2f2;
            color: #000;
        }

        /* Mobile Responsive Styles */
        @media (max-width: 768px) {
            .success-page-container {
                padding: 30px 20px 60px;
            }

            .success-animation {
                margin: 20px auto;
                width: 80px;
                height: 80px;
            }

            .checkmark {
                width: 80px;
                height: 80px;
            }

            .success-title {
                font-size: 24px;
                margin: 20px 0 12px;
            }

            .success-subtitle {
                font-size: 16px;
                margin-bottom: 20px;
            }

            .order-details-card {
                padding: 20px;
                margin: 20px 0;
            }

            .order-details-title {
                font-size: 18px;
                margin-bottom: 15px;
            }

            .order-info-row {
                padding: 8px 0;
            }

            .order-info-label,
            .order-info-value {
                font-size: 14px;
            }

            .button-group {
                gap: 10px;
                margin-top: 20px;
            }

            .btn-view-order,
            .btn-continue {
                padding: 12px 24px;
                font-size: 14px;
            }
        }

        /* Extra Small Devices */
        @media (max-width: 480px) {
            .success-page-container {
                padding: 20px 15px 50px;
            }

            .success-animation {
                margin: 15px auto;
                width: 70px;
                height: 70px;
            }

            .checkmark {
                width: 70px;
                height: 70px;
            }

            .success-title {
                font-size: 20px;
                margin: 15px 0 10px;
            }

            .success-subtitle {
                font-size: 14px;
            }

            .order-details-card {
                padding: 15px;
                margin: 15px 0;
            }

            .order-details-title {
                font-size: 16px;
                margin-bottom: 12px;
            }

            .order-info-row {
                padding: 6px 0;
            }

            .order-info-label,
            .order-info-value {
                font-size: 13px;
            }

            .btn-view-order,
            .btn-continue {
                padding: 11px 20px;
                font-size: 13px;
            }
        }

        /* Tablet Landscape */
        @media (min-width: 769px) and (max-width: 1024px) {
            .success-page-container {
                padding: 40px 30px 80px;
            }

            .success-animation {
                width: 90px;
                height: 90px;
            }

            .checkmark {
                width: 90px;
                height: 90px;
            }

            .success-title {
                font-size: 28px;
            }

            .success-subtitle {
                font-size: 17px;
            }
        }
    </style>
</head>
<body>
    <?php include "../ui/nav.php"; ?>
    
    <div class="success-page-container">
        <div class="success-content">
            <!-- Success Animation -->
            <div class="success-animation">
                <svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52">
                    <circle class="checkmark__circle" cx="26" cy="26" r="25" fill="none"/>
                    <path class="checkmark__check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/>
                </svg>
            </div>
            
            <!-- Success Message -->
            <h1 class="success-title">Order Placed Successfully!</h1>
            <p class="success-subtitle">Thank you for your purchase</p>
            
            <!-- Order Details Card -->
            <div class="order-details-card">
                <h2 class="order-details-title">Order Details</h2>
                
                <div class="order-info-row">
                    <span class="order-info-label">Order Number:</span>
                    <span class="order-info-value"><?php echo htmlspecialchars($order['order_number']); ?></span>
                </div>
                
                <div class="order-info-row">
                    <span class="order-info-label">Total Amount:</span>
                    <span class="order-info-value">₹<?php echo number_format($order['total_amount'], 2); ?></span>
                </div>
                
                <div class="order-info-row">
                    <span class="order-info-label">Payment Method:</span>
                    <span class="order-info-value"><?php echo strtoupper($order['payment_method']); ?></span>
                </div>
            </div>
            
            <!-- Action Buttons -->
            <div class="button-group">
                <a href="orders.php" class="btn-view-order">View Orders</a>
                <a href="shop.php" class="btn-continue">Continue Shopping</a>
            </div>
        </div>
    </div>
    
    <?php include "../ui/footer.php"; ?>
    
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

MMCT - 2023