51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
require_once 'header.php';
|
|
require_once 'db/config.php';
|
|
|
|
if (!isset($_SESSION['user_id'])) {
|
|
header("Location: login.php");
|
|
exit;
|
|
}
|
|
|
|
if (!isset($_GET['order_id']) || !is_numeric($_GET['order_id'])) {
|
|
header("Location: profile.php");
|
|
exit;
|
|
}
|
|
|
|
$order_id = $_GET['order_id'];
|
|
|
|
$pdo = db();
|
|
$stmt = $pdo->prepare("SELECT * FROM orders WHERE id = ? AND user_id = ?");
|
|
$stmt->execute([$order_id, $_SESSION['user_id']]);
|
|
$order = $stmt->fetch();
|
|
|
|
if (!$order) {
|
|
header("Location: profile.php");
|
|
exit;
|
|
}
|
|
?>
|
|
|
|
<header class="hero text-center">
|
|
<div class="container">
|
|
<h1 class="display-4">Order Successful!</h1>
|
|
<p class="lead">Thank you for your purchase.</p>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="container my-5">
|
|
<div class="row justify-content-center">
|
|
<div class="col-lg-8">
|
|
<div class="card">
|
|
<div class="card-body p-5">
|
|
<h3>Order Details</h3>
|
|
<p>Your order #<?php echo htmlspecialchars($order['id']); ?> has been placed successfully.</p>
|
|
<p>Total amount: $<?php echo htmlspecialchars(number_format($order['total'], 2)); ?></p>
|
|
<a href="profile.php" class="btn btn-primary">View Profile</a>
|
|
<a href="shop.php" class="btn btn-secondary">Continue Shopping</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<?php require_once 'footer.php'; ?>
|