compostTestSubmit.php 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * controllers/compostTestSubmit.php
  4. *
  5. * POST handler for compost test entry.
  6. * NOTE: Compost form fields are pending migration — this is a stub.
  7. */
  8. if (session_status() === PHP_SESSION_NONE) {
  9. session_start();
  10. }
  11. require_once __DIR__ . '/../config/database.php';
  12. require_once __DIR__ . '/../lib/auth.php';
  13. require_once __DIR__ . '/../lib/csrf.php';
  14. requireLogin();
  15. if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
  16. header('Location: /dashboard/crop-analysis/compost-test-data/compost-test-data.php');
  17. exit;
  18. }
  19. if (!verifyCsrfToken($_POST['csrf_token'] ?? '')) {
  20. $_SESSION['flash_error'] = 'Invalid CSRF token. Please try again.';
  21. header('Location: /dashboard/crop-analysis/compost-test-data/compost-test-data.php');
  22. exit;
  23. }
  24. // Compost form fields not yet defined — redirect with info message
  25. $_SESSION['flash_error'] = 'Compost test submission is pending full migration. Please contact your administrator.';
  26. header('Location: /dashboard/crop-analysis/compost-test-data/compost-test-data.php');
  27. exit;