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

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

if (isset($_GET['rfid_barang'])) {
    $rfid_barang = $_GET['rfid_barang'];

    // Hapus barang dari database
    $sql = "DELETE FROM inventaris WHERE rfid_barang='$rfid_barang'";
    
    if ($conn->query($sql) === TRUE) {
        echo "<script>alert('Barang berhasil dihapus');window.location='index.php';</script>";
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }
}
?>
