Files
winded/server/api/suggestions/detail.php
T
philip b239ae3e5f Initial commit: Flutter app + PHP/MySQL backend on Hostinger
Replaces Firebase with a self-hosted PHP/MySQL API served from
winded.prymsolutions.com. Includes full backend (schema, auth, events,
teams, brackets, suggestions, stats, media, file upload) and updated
Flutter repositories and domain models.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 20:13:57 -07:00

27 lines
712 B
PHP

<?php
require_once __DIR__ . '/../config/helpers.php';
cors();
$id = $_GET['id'] ?? '';
$method = $_SERVER['REQUEST_METHOD'];
$db = db();
if ($id === '') json_err('Missing id');
if ($method === 'PUT') {
require_admin();
$b = body();
$status = $b['status'] ?? '';
if (!in_array($status, ['pending','reviewed','implemented'])) json_err('Invalid status');
$db->prepare('UPDATE suggestions SET status = ? WHERE id = ?')->execute([$status, $id]);
json_ok(['updated' => true]);
}
if ($method === 'DELETE') {
require_admin();
$db->prepare('DELETE FROM suggestions WHERE id = ?')->execute([$id]);
json_ok(['deleted' => true]);
}
json_err('Method not allowed', 405);