diff --git a/admin/links.php b/admin/links.php index 3204b4b..bf27a83 100644 --- a/admin/links.php +++ b/admin/links.php @@ -7,12 +7,7 @@ if (!isset($_SESSION['user_id']) || $_SESSION['user_role'] !== 'admin') { } // Debug block for POST data - visible only to admin -if ($_SESSION['user_role'] === 'admin' && $_SERVER['REQUEST_METHOD'] === 'POST') { - echo '
';
-    echo 'DEBUG INFORMATION (admin/links.php - POST Data):
'; - echo 'POST Parameters: ' . htmlspecialchars(json_encode($_POST, JSON_PRETTY_PRINT)) . '
'; - echo '
'; -} + require_once __DIR__ . '/../db/config.php'; $pdo = db(); @@ -25,7 +20,7 @@ if (empty($_SESSION['csrf_token'])) { if ($_SERVER['REQUEST_METHOD'] === 'POST') { header('Content-Type: application/json'); - $response = ['success' => false, 'message' => 'Invalid request.']; + $response = ['success' => false, 'message' => 'Invalid request.', 'debug_post' => $_POST ?? [] ]; if (!isset($_POST['csrf_token']) || !hash_equals($_SESSION['csrf_token'], $_POST['csrf_token'])) { $response['message'] = 'CSRF token validation failed.'; @@ -407,6 +402,7 @@ document.addEventListener('DOMContentLoaded', function() { }) .then(response => response.json()) .then(data => { + console.log('DEBUG POST Data:', data.debug_post); if (data.success) { alert(data.message); window.location.reload(); // Simple reload for now, can be optimized later