<?php
include 'config.php';
checkAdminAuth();

header('Content-Type: application/json');

// تحديث آخر معرف طلب تم التحقق منه
$result = $conn->query("SELECT MAX(id) as max_id FROM orders");
if ($result && $result->num_rows > 0) {
    $max_id = $result->fetch_assoc()['max_id'];
    echo json_encode(['success' => true, 'max_order_id' => $max_id]);
} else {
    echo json_encode(['success' => false, 'error' => 'لا توجد طلبات']);
}
?>