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

$data = json_decode(file_get_contents('php://input'), true);
$order = $data['order'];

foreach ($order as $row) {
    $stmt = $pdo->prepare("UPDATE event_participants SET sort_order = ? WHERE id = ?");
    $stmt->execute([$row['sort_order'], $row['id']]);
}
echo json_encode(['success' => true]);
?>
