36459-vm/certificates/verify_action.php
2026-05-27 14:29:58 +05:30

32 lines
834 B
PHP

<?php
session_start();
include_once __DIR__ . '/../includes/db.php';
// Allow only POST request
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
die("Invalid Request");
}
// Check required input
if (!isset($_POST['certificate_id']) || empty($_POST['certificate_id'])) {
die("Invalid Request");
}
$certificate_id = trim($_POST['certificate_id']);
$stmt = $pdo->prepare("SELECT * FROM certificates WHERE certificate_id = ?");
$stmt->execute([$certificate_id]);
$cert = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$cert) {
echo "Certificate Not Found";
exit;
}
?>
<h2>✅ Certificate Verified</h2>
<p><strong>Student:</strong> <?= htmlspecialchars($cert['student_name']) ?></p>
<p><strong>Course:</strong> <?= htmlspecialchars($cert['course']) ?></p>
<p><strong>Date:</strong> <?= htmlspecialchars($cert['issued_on']) ?></p>