Auto commit: 2025-12-18T09:10:55.601Z

This commit is contained in:
Flatlogic Bot 2025-12-18 09:10:55 +00:00
parent 8be74c322f
commit 30eacc0737

View File

@ -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 '<pre style="background-color: #fdd; border: 1px solid #f99; padding: 10px; margin: 10px;">';
echo 'DEBUG INFORMATION (admin/links.php - POST Data):<br>';
echo 'POST Parameters: ' . htmlspecialchars(json_encode($_POST, JSON_PRETTY_PRINT)) . '<br>';
echo '</pre>';
}
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