<?php
include 'includes/db.php';
session_start();

$barcode = $_GET['barcode'] ?? '';
$einheit = $_GET['einheit'] ?? '';

if ($barcode && $einheit) {
    $stmt = $conn->prepare("SELECT id FROM ffw_geraete WHERE barcode = ? AND einheit = ?");
    $stmt->bind_param("ss", $barcode, $einheit);
    $stmt->execute();
    $result = $stmt->get_result();
    echo json_encode(['exists' => $result->num_rows > 0]);
}
?>
