35049-vm/refresh_submission.php
Flatlogic Bot 119d467b75 v2.0
2025-10-19 03:32:56 +00:00

29 lines
801 B
PHP

<?php
require_once __DIR__ . '/db/config.php';
// Check if ID is provided
if (!isset($_GET['id']) || empty($_GET['id'])) {
header('Location: analyst_dashboard.php?error=missing_id');
exit;
}
$submissionId = (int)$_GET['id'];
// Update the status to 'Pending'
try {
$pdo = db();
$stmt = $pdo->prepare("UPDATE submissions SET status = 'Pending' WHERE id = ?");
$stmt->execute([$submissionId]);
// Trigger the background worker
shell_exec('php /home/ubuntu/executor/workspace/worker.php > /dev/null 2>&1 &');
} catch (PDOException $e) {
// In a real app, log this error
header('Location: analyst_dashboard.php?error=' . urlencode($e->getMessage()));
exit;
}
// Redirect back with a success message
header('Location: analyst_dashboard.php?refreshed=1');
exit;