Competition ID is missing."; require_once 'includes/footer.php'; exit; } $pdo = db(); $stmt = $pdo->prepare("SELECT * FROM competitions WHERE id = ?"); $stmt->execute([$competition_id]); $competition = $stmt->fetch(); if (!$competition) { echo "
Competition not found.
"; require_once 'includes/footer.php'; exit; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['submission_file'])) { if (!isset($_SESSION['user_id'])) { echo "
You must be logged in to make a submission.
"; } else { $user_id = $_SESSION['user_id']; $file = $_FILES['submission_file']; // File validation if ($file['error'] === UPLOAD_ERR_OK) { $upload_dir = 'uploads/'; $file_name = uniqid() . '-' . basename($file['name']); $target_path = $upload_dir . $file_name; if (move_uploaded_file($file['tmp_name'], $target_path)) { $stmt = $pdo->prepare("INSERT INTO submissions (competition_id, user_id, file_path) VALUES (?, ?, ?)"); if ($stmt->execute([$competition_id, $user_id, $target_path])) { echo "
Submission uploaded successfully.
"; } else { echo "
Failed to save submission to the database.
"; } } else { echo "
Failed to move uploaded file.
"; } } else { echo "
Error uploading file.
"; } } } ?>

Start Date:
End Date:


Submit Your Entry

Please login to submit your entry for this competition.