<?php
session_start();
include 'koneksi.php';

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

$username = $_SESSION['user'];
$tanggal  = $_GET['id'];

// 🔥 update hanya transaksi ini saja
mysqli_query($conn, "
    UPDATE orders 
    SET status='Selesai'
    WHERE username='$username' 
    AND tanggal='$tanggal'
    AND status='Dikirim'
");

header("Location: orders.php");
exit;
?>